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
votes1
answer68
viewsDoes not display data on the Web Api Asp.net mvc screen
I started studying a bit of web api using Asp.net, I’m doing a very simple example where I just want to list the data from the employee table, but I get error: No Mediatypeformatter is available to…
-
0
votes1
answer846
viewsConfiguration of the Web.Config file
I wonder if I can leave the recipient’s email on web.config, if I can, how to deploy. I created a variable and gave the value of the email, but if I need to change I will have to compile dnv, if I…
-
0
votes0
answers235
viewsC# & Mongodb - How to filter in child document?
I am starting my adventures in Mongodb and I have a problem specifically with the filtering of documents. The model of my application: public class MatrizCurricular { [BsonId] public ObjectId _id {…
-
0
votes1
answer170
viewsChange Button name via WPF code?
I’m looking to access a control in WPF to access the properties of it and modify. However, I can’t find much approach to Wpf currently. What I want to do, for example, is change the name of a button…
-
0
votes2
answers796
viewsError inserting a "SELECT" item into the Combobox
How do I add an item to the Combobox? The item has to be the first on the list with the text "SELECT": I’m doing like this: private void PreencherCmbIndicacao() { try {…
-
0
votes2
answers90
viewsWhen field validation is triggered, dropdownlists do not load into Asp.net core MVC
When I start a registration screen, the system loads a ViewModel with the combobox loaded: If I, for example, click the record button, the fields in my viewmodel are validated, only the page does…
-
0
votes1
answer31
viewsUnknownnode when loading XML in class
I get the following XML from a database (modified data, but the structure is this same) <registro> <header> <codUsuario>XXX</codUsuario>…
-
0
votes2
answers156
viewsProblem adding C#images
I’m trying to create an object like Image from an existing image, which will be inserted into a Frame and which in turn will be inserted into a Stackpanel. However, only images/icons that are…
-
0
votes2
answers31
viewsJsonresult values are received by javascript but fields do not receive value
Javascript function receives values but fields are not receiving values. Function of the Controller public JsonResult GetSequencia(DateTime dataAbate) { db.Configuration.ProxyCreationEnabled =…
-
0
votes1
answer492
viewsPostback Asp.Net Webforms
I just started working with WebForms and it became a question, due to always messing with the asp.net mvc. Supposing I have one DropDownList and populated the DataSource of it with various records,…
-
0
votes0
answers41
viewsDropdownlist Asp.net mvc
I have a product that can be registered in 2 stores A and B if I have already registered in A how do pro Dropdownlist show me only show option B next time it is in register? what would be the logic?…
-
0
votes1
answer264
viewsNot null parameter in Int fields
I am creating an application in Asp.NET MVC (I am using the Scafffolded feature), however, all the whole fields are being required to be filled in, as I remove this parameter? Note: I have tried to…
-
0
votes1
answer113
viewsTranspose list of objects
How can I transpose the columns of a table like the one in the image below For this format: Mercado | Semana 5 | Semana 6 FUT AUD | 0.9986 | 1.0035 FUT CAD | 1.0000 | 1.0062 FUT CHF | 1.0059 |…
-
0
votes1
answer225
viewsRemove Dynamic Picturebox
I have an "Add" button that when clicked opens a screen for the user to select an image, this image is added to a flowLayoutPanel. A dynamic "Remove" button is added to pictureBox, when this button…
-
0
votes1
answer126
viewsConvert extracted binary from . getUserMedia() to . mp4
I am storing the user’s video and audio using . getUserMedia() in javascript and sending it to a websocket listening in C# (MVC). I leave down the path that the data makes until it reaches the…
-
0
votes2
answers591
viewsHow to pick up the selected item
Hi, I’d like a hand, I’m using the DEVEXPRESS framework. I have a form with a Gridcontrol, In this Gridcontrol I have a Doubleclick event. When I click on the selected line I want to take only the…
-
0
votes1
answer28
viewsI am making a simple program to study Vectors, when I run it appears the error "Index was Outside the Bounds of the array" on line 24
using System; public class Program { public static void Main() { int i, n; Console.WriteLine("Entre com o número de Alunos: "); n = Convert.ToInt32(Console.ReadLine()); String[] nome = new String…
-
0
votes1
answer42
viewsDisplay automatic date sequence
I have a question about Datagridview: I’m making a payroll system, in that system I have to bring the first day of release and the final day. The problem is that, for example, I need to make a…
-
0
votes0
answers82
viewsHow to ignore a "Duplicate entry error" in MYSQL and insert the remaining un-duplicated
How to ignore a exception and insert the rest of the fields when I get this error in MYSQL using mysql . NET Connector? Mine try catch is as follows: try { conexao.Open(); MySqlDataReader reader =…
-
0
votes0
answers50
viewsError in connection to oracle database after doing Publish on Azure with visual studio
I am developing a project in Asp.net with Oracle data base 12c. The connection to the database locally works. It does all CRUD functions. I am also using the services of Azure (project requirement),…
-
0
votes1
answer99
viewsProblems with executescalar (System.Data.Sqlclient.Sqlexception)
I have the following block of code: sqlConn.Open(); SqlCommand inserirAluno = new SqlCommand("INSERT INTO ALUNOS (Nome, DataNascimento, CPF, Endereco, Bairro, " + "CEP, Cidade, IdEstado, Sexo)…
-
0
votes0
answers68
viewsActionresult Create error
I’m with a exception, in the method of creating an object with a foreign key, db.SaveChanges() with the following message: Dbupdateexception was unhandled by user code. [HttpPost]…
-
0
votes1
answer113
viewsSerealize a JSON String C#
I wanted to set up a JSON String, but I can’t create the class the way I need to, I can get information up to the first level, but I can’t create sub-keys. For example I want the string to be {…
-
0
votes1
answer49
viewsHow to create List of a class within another class and not be mapped in Entity Frameworks
I have a class called Chamber [Table("Camara")] public class Camara { [Key] public int CamaraId { get; set; } [Display(Name = "Nome")] [Required(ErrorMessage = "O Campo {0} é requirido!")]…
-
0
votes3
answers870
viewsHow to pass a value from one method to another method within the same class ? C#
I would like to pass the tot variable that is in Registration float expenses to the Show expenses method. Can someone help me ?? class Ex4 { List<String> descricaodespesas = new…
c#asked 6 years, 8 months ago Guilherme Schubert Medeiros 9 -
0
votes1
answer64
viewsCheckbox does not load returned data in JSON
I’m having trouble loading a checkbox (<select>) using C# MVC with Json. The method returns the complete list with objects, but does not click on the checkbox. Man Controller: public…
-
0
votes0
answers38
viewsRun nhibernate on macOS X 10.13.3 (c#)
Good morning, I’m new to the world of C# programming and therefore had some problems compiling a project by visual studio for mac. The problem was this, the project uses version 4.0.3 of nhibernate…
-
0
votes2
answers75
viewsError when doing sum inside foreach
I have this method CadastroDespesas, only that he is making the wrong sum in foreach going through my list. I don’t know what it is, if anyone can help me... To totdesp is a global variable declared…
c#asked 6 years, 8 months ago Guilherme Schubert Medeiros 45 -
0
votes2
answers55
viewsProblem saving data to database
I created a simple application, but when clicking on the action button responsible for saving the data, the program stops working. Follow picture: Save button action:- private void…
-
0
votes2
answers184
viewsEF - Navigating through Icollection
I have the following class in an application for C# practice purposes with Entityframework: public class Livro { public Livro() { Autor = new HashSet<Autor>(); } public int Id { get; set; }…
-
0
votes1
answer79
viewsHow to make an Annotation data validator based on another field?
I’m trying to implement a validator based on another field. My class of domain. [Required] public string _tipoDeControle { get; set; } [NotMapped] public TipoDeControle TipoDeControle { get { return…
-
0
votes1
answer40
viewsWhy does the matrix get extra lines?
private void abrirLabirintoToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog Abrir = new OpenFileDialog(); Abrir.ShowDialog(); string CarregaArq = null; string teste = null;…
-
0
votes1
answer62
viewsXamarin Android WCF to after enter more than 10 times
I have an app on Xamarin android that consumes a wcf service, when I instate the service more than 10 times the service falls and you need to restart it and when it will restart the bar you need to…
-
0
votes0
answers113
viewsC# Xamarin: Sqlite table from Mappings classes (Entitytypeconfiguration<Class>)
I’m trying to create some tables on sqlite with VS Community 2017 (c# and Xamarin android) from classes that are defined by Entitytypeconfiguration. Below I try to better detail my difficulty. I…
-
0
votes0
answers222
viewsI cannot select a listbox item and get the other information in the Database from that selected item
The idea of the software is to select a name in the combobox (cmb_nameGu) and with this play in the listbox (lst_result) all found dates that contain the chosen name, to later click on existing…
-
0
votes1
answer164
viewsWeb service with c#
I need to consume a web service. I added the server to Add web reference, everything worked out. In the documentation he asks for the following: getPedido(login as string, passwd as string, XML as…
c#asked 6 years, 8 months ago João Bosco 41 -
0
votes2
answers118
viewsReading Files in C#
good night, a help for kindness. I have the following file: 34543;PRIMEIRA PESSOA;230778;CASADO;BANCARIO 23543;SEGUNDA PESSOA;12051985;CASADO;ADMINISTRADOR DE EMPRESAS 36116;TERCEIRA…
-
0
votes1
answer326
viewsHow do I change the csv header, C#
I’m generating a CSV file, but I’d like the header was the same as anottation displayname. When I export, the displayname is ignored. call of the method string csv = ListToCSV(resultado); private…
-
0
votes0
answers69
viewsDoubt about relationship implementation N:N using C#
I am having to make a relationship between classes N:N but storing objects in memory, follows the following relationship: I did the implementation as follows and I would like to know if it is…
-
0
votes1
answer1434
viewsSequence contains error in Elements Asp.net
Good morning. I am trying to send an ajax request in jquery, but it returns this error. Sequence contains in Elements, I’m wanting to present data in bootgrid public…
-
0
votes1
answer468
viewsForce POSTBACK
I’m passing information on the variable click_teste for a TextBox with id others that TextBox is a parameter for a query of a Gridview. I need that when receiving the data the textbox make one…
-
0
votes1
answer23
viewsPull Characters from a column in the datagridviwer
I have a little problem, I have a datagridviwer that I fill a table in the database, just before to fill precious take the strokes of the content of the columns. You can use Replace in a…
c#asked 6 years, 8 months ago Junior Guerreiro 617 -
0
votes2
answers52
viewsError when trying to use class/method of a library.
I am trying to connect a WPF to an external hardware via usb. I installed the Hidsharp Nuget and declared the USB Devices as below: HidDevice _device; HidStream _deviceStream;…
c#asked 6 years, 8 months ago Eduardo Cardoso 644 -
0
votes1
answer81
viewsVery slow query to export in excel
I created a method to export a few columns to xls and it is very slow the process, it takes about one minute to do the whole process. public void Download(string datainicio, string datafinal, int?…
-
0
votes2
answers460
viewsUpdate table after insert into another
I have a table called Consumption, in this table I have a column Quantity. I have another table called Product, in this table I have a column Stock. Where a new consumption is introduced, a product…
-
0
votes1
answer44
viewsError in expression
Can anyone help me with the following mistake? Here below is my code. I am trying to fix this error, but I did not succeed. public IEnumerable<Dia1> GetPendenciasByUser(int centroId) { var…
-
0
votes1
answer247
viewsRemove MVC URL parameter name
I have the following URL /vlog/usertimeline/? Slug=tests for the Vlog controller, usertimeline action and Slug parameter. How should I set the route to stay /vlog/usertimeline/tests I’m using MVC 4.…
-
0
votes4
answers487
viewsFill a datatable from a txt
I have a datareader writing directly into the text file, int count = dataReader.FieldCount; while (dataReader.Read()) { for (int i = 0; i < count; i++) { file.WriteLine(dataReader.GetValue(i)); }…
-
0
votes0
answers69
viewsRecording with Naudio with C#
I’m recording audio with the code below: public WaveIn waveSource = null; public WaveFileWriter waveFile = null; private void StartBtn_Click_1(object sender, EventArgs e) {…
-
0
votes1
answer569
viewsError: Must declare the scalar variable
Can someone help me with this? Must declare the scalar variable "@hospitalId". Pendenciacontroller: public async Task<ActionResult> Index() { if (!Cookies.Exists("hid")) return…