Most voted "c#" questions
This tag should be used when the question refers to some resource, information or problem related to the C#language. C# ("C Sharp") is a multi-paradigm programming language that has strongly typed variables, is imperative, declarative, functional, generic, object-oriented and component-oriented, which are designed to be executed in . NET Framework.
Learn more…13,899 questions
Sort by count of
-
0
votes0
answers54
viewsProblems running Javascript Asp.net core
I copied some folders containing css scripts and javascript for wwwroot these files are being referenced in my Shared/_layout. A message appears in the upper corner of my Visual studio 2017 window:…
-
0
votes1
answer575
viewsI would like to check in the customer register if the code entered already exists. How do I?
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AtFinal { class Program …
-
0
votes0
answers45
viewsAjax redirects to url
Good morning guys, I’m having a little problem, I imagine it’s simple, but I can’t seem to solve it. Next, I have to upload a profile photo of the user, the code is working beauty: JAVASCRIPT…
-
0
votes1
answer25
viewsDatagridview doubt in C#
I would like to know what is and what these types of codes are used for: txtCodigo.Text = dtgProfessores.Rows[e.RowIndex].Cells["CODIGO"].Value.ToString(); txtNome.Text =…
-
0
votes2
answers315
viewsChange button name in event
I was making a change to the name of the buttons in the project and accidentally clicked twice on the button, so he opened the code, as the variable opened the code with the name button7. As I had…
-
0
votes0
answers148
viewsXAML C# Resources - How to add a list of dynamically based Resources Image in a folder
I’m making a FlipView using MahApps.Metro. I have a list of images that would be passed to this flipview. It works, but I’m making them add dynamically in a way that I think is incorrect: <Image…
-
0
votes1
answer72
viewsIntegrity breach not released in BD Sqlite
CRUD in C# is not throwing integrity breach error while deleting BD Sqlite dependent record. query = "DELETE FROM "+ table + " WHERE id = '" + id + "';"; int returnValue = 0; try { conn = new…
-
0
votes0
answers243
viewsClient can connect to server but crasha when will receive data
Here’s the part of the code that misses: private void buttonAbrirConexão_Click(object sender, EventArgs e) { try { socketOfServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream,…
-
0
votes0
answers40
viewsHow to compare 2 fields with date
Hello, I have two fields, one with today’s date and one with a date in nine days. I need to make a comparison between the 2 fields to know if the field with the second date is in 10 days or less,…
-
0
votes0
answers21
viewsKnowing if a process is critical
If my program closes a critical process, there will be a blue screen. So, how do I know if a process is critical? If this process is critical, then my program will not close it.…
-
0
votes1
answer902
viewsGenerate plot values and dates in a datatable c#
Hello, I have a form where is placed a Total Sale Value, the Number of Installments of Payment. Then I would like my Datatable that is located in the other Form to present the values and the due…
-
0
votes1
answer29
viewsAppropriate way to handle data received from the server
Send something, a username for example writer.WriteLine(Username.text); And after processing the data on the server, I return something like: stwSend.WriteLine("a2|Cadastro efetuado com sucesso!");…
-
0
votes2
answers94
viewsMultidimensional Json for Object in C#
I’m learning c# and I’m having a hard time passing a multidimensional json to Object by doing an deserialize. I don’t really know how to fix it. See my json string json2 = @"[ { firstName: ""joao"",…
-
0
votes1
answer139
viewsIdentify two pressed modifier keys
How to identify which two keys are pressed inside a button click event? Example: Button btn = new Button(); btn.Click += Btn_Click; private void Btn_Click(object sender, EventArgs e) { // Assim…
-
0
votes1
answer114
viewsTransferring image via socket, image turns black
My server sends a command to the client and the client sends a Printscreen to the server using this code: Image printScreen = new Bitmap(monitorWidth, monitorHeight); Graphics graphics =…
-
0
votes1
answer48
viewsSynchronize player and host movements
Hello. I am doing a school project and am following the tutorial of Unity Multiplayer Netorking. Everything worked correctly, but the tutorial teaches to have a player and a host, both with a…
-
0
votes0
answers1061
viewsSend XML via POST
I have the following example to send XML via POST: public string EnviarXmlSoap(string methodName, string body) { WebRequest webRequest =…
-
0
votes0
answers122
viewsreturn/download pdf from backend to ajax
I am converting an html to pdf, I managed to generate the pdf in the backend with Submit, but with ajax I cannot download the pdf.. How can I treat in ajax to download? Code: [HttpPost]…
-
0
votes1
answer34
viewsAvoid Windows compatibility mode
I’m maintaining an old code in c#. The program was installed on Windows 7 at the time it was created, now with Windows 10 it is necessary to run with compatibility mode to work. Compiling with a…
-
0
votes0
answers115
viewsWeb API (C#) copies files from external directory
I have a Web Api in C# . net framework. In this application I have a method responsible for copying some files to a local directory, where I have my frontend. The problem I’m having is that my web…
-
0
votes1
answer73
viewsPost with no fronend
I’m trying to make a Post of a form info but I don’t quite know how to do. This is my C form# : @using (Html.BeginForm("Enviar", "Mensagem", FormMethod.Post, new { enctype = "multipart/form-data",…
-
0
votes1
answer34
viewsGet CCO from C#email
I have a system that checks emails, and I have the following code where it searches the recipient or the field "with copy": if (client.GetMessage(i).Headers.To != null) { var msgTemp =…
-
0
votes1
answer513
viewsSend PHP POST request via Xamarin
I need to submit a request on POST for a php file through this application. This code worked correctly on Windows Forms, however in Xamarin it’s not working... public void testar() { try { string…
-
0
votes1
answer618
viewsRemove form button and remove code
Good afternoon guys, how can I clear the code in the situation where, I put the buttons as a certain use, then we decided to take the buttons but the codes are there, ( the events click ) How can I…
-
0
votes0
answers25
viewsXaml parameterless constructor
Well, I have a problem that I cannot solve, when I go to a preview of what I did in "XAML", I always come across this error.…
-
0
votes1
answer195
viewsCreate a list and insert the sheet data into the database when importing
I have a method protected void importar_Click(object sender, EventArgs e) and inside it I check if the file was selected, and validate the file extension. This system is a file import system of a…
-
0
votes1
answer68
viewsUnity 3D Command Solution
I need a C# script that makes 2 commands by pressing a single EX key: (I want to make my character crouch by pressing "c" and when to press the character back up) could someone help me ?
c#asked 6 years, 9 months ago Gustavo Bianco 51 -
0
votes1
answer513
viewsHow to use Tiles in Unity 5?
I’m in big trouble. I’m doing a role-playing game and using tilesets with the 32x32-dimensional Tiles for all of the game’s graphics, but Unity doesn’t support tilemaps. I’ve looked for plugins and…
-
0
votes1
answer38
viewsMask for variable size input field with windows Forms
How to make an email mask in a Windows Forms application ? To using Maskedtextbox that to validate fixed size fields, example: ZIP CODE and CPF the problem is when the mask is of varied size for…
-
0
votes2
answers47
viewsForm creation error with Entity framework
There’s a mistake going on that I can’t identify I know that Beginform in Create.html from the Entity framework, has some upload options to overload, one of them is the one I’m using, whose request,…
-
0
votes1
answer709
viewsError when publishing in iis
I’m with a webservice and doing the post on the server I’m getting the error answer Unable to load file or Assembly 'Microsoft.CodeDom.Providers.Dotnetcompilerplatform, Version=1.0.8.0,…
-
0
votes0
answers31
viewsReceive JSON via Moip POST on a C#/. Net MVC platform
[C#/. Net][Moip] Personal, I use a payment platform (Moip) and it has a function that send notification in JSON format to the URL you registered, which will be from your system on the server. I want…
c#asked 6 years, 9 months ago Sanderson Corrêa 1 -
0
votes1
answer651
viewsView a Youtube video via videoView via Xamarin
I need to show a video for a URL, such as a youtube link, using the tool Videoview, or similar. I did some research on this, and I got this code, but it didn’t work, I always get the message that I…
-
0
votes0
answers180
viewsApplication runs by visual studio, but does not run when executed
I’m using visual studio 2017, I created an application with WPF, the application normally runs inside the visual studio in debug mode, but if I compile it and run from inside the release folder, it…
-
0
votes1
answer38
viewsPrevent Refresh on the page from generating additional queries to the BD MVC C#
This is the case. My Actionresult does a heavy database query and returns randomized data by business definition. The user can refresh the screen. If you update the page, you lose what was done and…
-
0
votes2
answers45
viewsRe-registration in the Database
In a database table with the fields Productoid, Description, Unit price and some others. I have a screen that only allows updating the Unit Price field, at the time of re-recording the record in the…
c#asked 6 years, 9 months ago Gilberto V. Gonçalves 43 -
0
votes0
answers701
viewsConsuming Web Reference C#
I’d like a little help from you I added the Service via Web Reference NFSeBeloHorizonteMG.NfseWSService ws1 = new NFSeBeloHorizonteMG.NfseWSService(); ws1.Url = hostWS; X509Certificate certificado =…
-
0
votes1
answer62
viewsRead a folder file and determine if it is the same as the website
I’m doing an Auncher autoupdate on c# . net and I need my program to read a database file that’s in the same folder as it is and see if it’s the same as my site, and if it’s different, it download.…
-
0
votes1
answer192
viewsReporting Modeling in ASP NET MVC
I have several reports in the company, and I need to migrate them from webforms to MVC. My question is.. Do I need to create a template for each report? Is that correct? If not, how can I do? For…
-
0
votes1
answer192
viewsHow to use Enum with Entityframework
I have a relationship in my system where one class has a relationship with another, but this other class is nowhere in the system to change/delete its state (are only static data). I wonder if the…
-
0
votes1
answer29
viewsReportview file cannot view Design
I’m starting to use Report View, but I have a problem. When I create a project with the Report template the generated file cannot open the design, I can only view this code, as below. <?xml…
c#asked 6 years, 9 months ago Gilberto V. Gonçalves 43 -
0
votes2
answers114
viewsWhy is there the term "Private" in . NET?
Declaring variables without specifying the variable access level in C# and Visual Basic . NET ends up making the private, only the type/location where it was created can access and/or modify it.…
-
0
votes1
answer363
viewsNull parameters in the controller when sending post via ajax
I am refactoring an ASP.NET MVC application written by another developer. My intention is to remove the use of FormCollection. Before the controller method signature was the following: public…
-
0
votes3
answers262
viewsHow to access Form1 members from Form2?
I’m looking to access members of Form1 using the Form2. For example, I want to change the color of "Panel1" that is inside "Form1" to black: This is the way I’m doing it public partial class Form2 :…
-
0
votes1
answer73
viewsConnection error while performing query
I’m a beginner in programming and I’m trying to connect to a database. But by clicking the "Search" button to browse the database and exbir values on my screen, the following error is generated…
-
0
votes1
answer272
viewsDynamic filters using lambda
I have a table Errosproducao_records linked to another table called Errosproducao_tipos. I need to perform dynamic filters in the table Errors_records using lambda expressions. if I perform the…
-
0
votes1
answer110
viewsHow to stop printing positions = 0 of a vector?
In the example below, how I would fail to print the positions of this vector that are equal to 0 int[] caluculo = {50,6,0,59,6,7,0,6,8}; for(int i = 0 ; i < 9 ; i++) {…
-
0
votes0
answers61
viewsLoad Load Control C#
I need to add a conditional Usercontrol. How? if the Pap_id variable is equal to 134, I need to load a Usercontrol displays two inputText for the user to enter a start date and an end date: var…
-
0
votes1
answer512
viewsc# Web mvc Send PDF without saving to disk and send by email
Hello, I have an MVC web application and I have a method to send an email and I have to add a PDF that is dynamic, I have to attach it in this email without saving on disk. Could someone help?…
-
0
votes0
answers372
viewsHow to read/open an FTP file via C#
My scenario is a app where I need to open a file in . PDF; do not download, I want to open it direct. I found several tutorials where they teach Uploads and Downloads, but none that shows how to…