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
-
-1
votes1
answer48
viewsDisplaying SQL Server data in Windows Forms
I am wanting to display the information of certain person I am looking for in the SQL Server Database on a label in Windows Forms, but when I run the code it displays…
-
-1
votes1
answer34
viewsLogin authorization
Guys I have access authorization login, only when I execute the authorization it deletes the previous one and stays the current one. For example: I have the user login (basic), to execute an action…
-
-1
votes1
answer30
viewsHow to read a 'Boolean' column using NPGSQL?
I have the following code at the event Validated textbox: NpgsqlConnection conn = new NpgsqlConnection( "Server=127.0.0.1; port=5432;User; Id=postgres; Password=572600;Database=Sistema");…
-
-1
votes2
answers63
viewsDeserialize XML for object comes with null information
I am having trouble trying to deserialize an XML returned by the webservice to an object in my project, what happens is that the object is created, but with all properties without value (nulls). The…
-
-1
votes1
answer66
viewsHow to insert an "if" into an INSERT string in the database?
I have the following variable DateTime ContaRecebeDataPagto = Convert.ToDateTime(dgOrigem.SelectedRows[0].Cells[2].Value.ToString()); She gets a value from DataGrid, in some cases the date of…
-
-1
votes1
answer72
viewsHow to make Class1.Cs appear?
In my WEB FOLDER I have the file aspx.cs and the following code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using…
-
-1
votes1
answer26
viewsSearch from a property in a list of a certain class
I am trying to filter the results from a property of a class, within a list. Today I have the following structure : public class Jogo { public int Id { get; set; } public string Titulo { get; set; }…
-
-1
votes1
answer20
viewsLayout Logo breaks when exiting Index
Hello, my logo breaks after leaving the index, whatever the view(Edit,delet, etc.), it breaks, in the index is normal, I would like to know how to fix it, following the error and the code. I’m using…
-
-1
votes1
answer120
viewsSystem.Data.Sqlclient.Sqlexception: 'Incorrect syntax near 'messaging'. '
I tried everything, changed the codes, changed several things but the error prevails. Code: class Program { public static void Main(string[] args) { List<string> listaProcesso = new…
-
-1
votes1
answer58
viewsproblems in debugging with Xamarin
I’m a beginner in the world of programming and recently met Xamarin and decided to learn a little about him. When emulating the apps I searched how I could debug (or debug, I’m not sure what the…
-
-1
votes1
answer81
viewsError mounting a Json via code
I’m trying to ride a Json in the following structure: "contatos":[{"contato":{"sequencia":"2046","codigo":"2046","nome":"teste…
-
-1
votes1
answer45
viewsHow to prevent a record when edited to save in duplicity?
This snippet of code saves the themes of a record. However, when I edit a record by adding a new client, the last theme of that record duplicates. That is, every time I edit a record it duplicates…
-
-1
votes1
answer44
viewsHow do you create voids that change the value of a variable without IF? (like Python methods)
To simplify my question, I will show the Bubble Sort in python: def bubbleSort(self): for i in range(len(self) - 1): for j in range(len(self) - 1): if self[j] > self[j+1]: self[j], self[j+1] =…
-
-1
votes1
answer31
viewsI wanted to know how to connect the database data to the chart data in Windows Forms C#
I have no idea how I’m going to handle the data, so far what I’ve tried to accomplish is this code: public void loadChart() { MySqlConnection conexao = new MySqlConnection();…
-
-1
votes1
answer169
views@bind and @onchange for a select on blazor c#
Hello, I’m new with blazor I wanted to do the following. I have 2 Lists, Category and another List2, in the form I have 1 select for the category and another select for List2, and I wanted to make…
-
-1
votes2
answers105
viewsC# calculator not working
I created a method that asks the user to type numero1 and numero2 (is a simple calculator algorithm), but this method does not store what the user types, regardless of the operation option the user…
-
-1
votes1
answer37
viewsI need to insert phone number and mobile number in the same textbox using masks in Windows form C#
Type I wanted to know if there is any way to create a format whenever the user type some characters (ex: 8 for phone and 9 for mobile), already identify and apply in the textbox. Or when the user…
-
-1
votes1
answer36
viewsDoes anyone know how to solve the System.Formatexception problem ("incorrect character input)
Does anyone know what could be causing the Exception error in this code? (yes, I’m a beginner) using System; class Aula06 { static void Main() { double valorCompra = 5.50; double valorVenda; double…
-
-1
votes1
answer108
viewsI created a C# email API using smtp google, but I can’t publish it
The API is working properly with google smtp, rescuing data from a page form and sending the email (tested by Postman and running locally), the only problem is that I am not able to publish, I have…
-
-1
votes1
answer54
viewsSystem.NullReferenceException. How to include fields from another table?
Friends, I had a table Pessoa that contained a lot of user information. I decided to create a table Aluno to separate the information. My tables are like this: Person: Cod, Nome, Email, Senha Pupil:…
-
-1
votes1
answer19
viewsHow to delete xml file with c#?
I am using this code to create the XML file, but I wanted to know how to delete one without having to go to the folder and delete manually. DataTable table = new DataTable("tbl");…
-
-1
votes1
answer85
viewsERROR DESERIALIZE JSON WITH C#
I’m getting error System.Invalidoperationexception: 'The 'project.classeCategories' type is not supported for deserialization of an array.' by deserialize JSON below: See how I’m getting JSON in C#:…
-
-1
votes1
answer20
viewsIonic.Zip Complete Extract C#
Hello I am using using using Ionic.Zip; and this extracting right however at the end when it finishes extracting need to erase the ZIP file q it was extracting and I am not seeing function to…
c#asked 3 years, 8 months ago Cristiano Rogoy 27 -
-1
votes1
answer24
viewsHow to hide and return a guide
Good night! I am developing a system with customer registration and I am new to programming and I would like to know how to do so as soon as I open the form only the first tab remains open and when…
c#asked 3 years, 8 months ago Jpbreis 92 1 -
-1
votes1
answer40
viewsSearch by name in spreadsheet C#?
I am trying to do a name search inside an Excel spreadsheet, by code works normal, but I would like to search by name, when I do the search with the abix code, returns the error: private void…
-
-1
votes3
answers42
viewsc# - Update excel spreadsheet with textbox text
I’m trying to update a spreadsheet data by textbox. I tried the code below and it did not generate any exception, but did not update the spreadsheet. private void button2_Click(object sender,…
-
-1
votes1
answer24
viewsHow to get the Keys values of a Keyvaluepair c#object?
I have a Json with the following structure: { "Data" { "Request": [ { "text": "Minha Pergunta?", "response": "Minha resposta" } ] } } I do as follows to receive the values in the code:…
-
-1
votes1
answer36
viewsAudiosource Error with Unity prefabs
I made some Prefab and put some of them on the scene while running a script. The script is responsible for destroying the enemy when a player steps on a Colisor in his head (that Colisor is the…
-
-1
votes1
answer41
viewsHow to assign a class to one of another Class
In a program I created a class called Player and in it assigns various values, among them there is the value of Itens. In addition to this class, there is another class called Itens with different…
-
-1
votes1
answer34
viewsC# - Connect Gridcontrol with a List and manipulate the records in run-time
all right ??? This is my first question here on stack overflow, I’m sorry if I did anything wrong !!! I’m starting with C# and Devexpress and I’m trying to create an example using Devexpress…
-
-1
votes1
answer48
viewsMake INNER JOIN with more than one table
I want to relate Inner Join in the Employee table with Address, And department and function but only that the function table is foreign key in the department table. INNER JOIN no C# SqlDataAdapter…
-
-1
votes1
answer53
viewsInsert values x into table A if exist on table B
I want to Insert in table A of the key field, but only if this key already exists in table B Example Insert key(123) in table B if there is key(123) in table a (am using sql procedures managemente…
-
-1
votes1
answer24
viewsModel does not recognize the Datetime format
Hello, I am creating a program to learn a little more about . NET C#, this project is a simple CRUD project. But I have a problem in my model, when I run the program to create a new record it is…
-
-1
votes1
answer36
viewsHow to compare two fields (stock and minimum) of the same Table in (Mysql) using C#?
Thank you from now on, Using Visual Studio and Mysql: I need to display in my GRID a list of products that only where the 'stock' field is smaller than the 'minimum' field of my Products Table'. I…
-
-1
votes1
answer25
viewsError creating parameterized SQL
I need help with an error message. Invalid column name@. This message appears as an error at the end of the program run using System; using System.Collections.Generic; using System.ComponentModel;…
c#asked 3 years, 6 months ago Genesis Henriques 1 -
-1
votes2
answers73
viewsC# Newtonsoft.Json - Add property during serialization
Hello! I’m trying to customize the serialization of a class using the Newtonsoft.Json. My intention is to add a property in JSON during the serialization of the object. Following the official…
-
-1
votes2
answers59
viewsError clicking button to save data to database
Good morning guys, I’m trying to save some data in the database, for a button of windows form C# and this error appears. I have tried everything but the error persists. I did the print and pasted…
-
-1
votes1
answer47
viewsReorder numerical sequence when changing array position
I have a list of financial categories My model public class Categoria { public Guid Id {get;set;} public string Nome {get;set;} public int Sequencia {get;set;} } And as you move them up and down you…
c#asked 3 years, 6 months ago Marcelo Dias 73 -
-1
votes2
answers42
viewsHow to standardize the phone input in a Textbox C#
Hello, I’m doing a Customer Registration system and I have a problem that I have no idea how to fix, I know it’s "simple" but I’m programming a little and I haven’t found any way that really works.…
c#asked 3 years, 6 months ago Jpbreis 92 1 -
-1
votes1
answer263
viewsRead a txt file, insert into an array and display in a textbox in C#
I need to open the txt file with the data already inserted with three columns and separated by ';' and after opening the file I insert it into an Array with List, save the data and need the values…
-
-1
votes1
answer23
viewsWhat is the best way to read entity properties in "Include" with similar names?
I have the following consultation: var recs = (from p in _db.Fichas .Include(c => c.Tipo01) .Include(c => c.Tipo02) .Include(c => c.Tipo03) .Include(c => c.Pessoa01) .Include(c =>…
-
-1
votes1
answer60
viewsCreate Zip files and unzip using . NET 3.5
I’m making an online installer for my Github program, I made a Form with some basic controls. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using…
-
-1
votes1
answer39
viewsHow to show Escape sequences as String in C#?
I have a C# method that takes a String and sometimes has output escapes inside, like \n. It does its function normally, which is to skip the line. But I want them to be shown as String. How can I do…
-
-1
votes1
answer22
viewsFill Labels with values from a Mysql Database table
C# and Mysql I’m trying to get the table values Employees of the current user logged into the program and displayed in the Windows of my form, however the values are not being returned, my guess is…
-
-1
votes1
answer44
viewsI cannot authorize my HTTP methods with the token generated by Bearer and Jwt
Good night, I am implementing authentication and authorization in my Web API in Asp.net core 5.0. Yesterday, I had success with some authorizations. However, when I went to try to finish…
-
-1
votes1
answer28
viewsHow to automatically switch and show between MDI child windows on a parent MDI in c# visual studio?
I have an application that when it loads the main form (parent), it automatically creates two children Forms and show maximized, I use the following code in the Parent form to create the two Forms:…
-
-1
votes1
answer30
viewsDropdown Blazor
How do I dropdown Sub Categories to bring the data according to what I chose in the categories table ? I can only pull from the database but I don’t know how I do the sub-category pull from the…
-
-1
votes1
answer40
viewsc# problems in calling screens that even the teacher could not solve
Mens, I’m taking a DS technical course, I’m in the TCM phase and I was wondering if you can solve or help me with this problem: Next: I am doing a CRUD in c# win Forms and I came across an error…
-
-1
votes1
answer45
viewsHow to popular a class with a C#string list
On the system I’m developing I send a select with multiple options to a list of string type in my controller, I now need to link this list I get from the view to the list with the login class I have…
-
-1
votes1
answer70
viewsCS1503 error: Argument 2: cannot convert from "string" to "Microsoft.EntityFrameworkCore.Serverversion"
Help me boys, I’ve tried everything and the mistake doesn’t come out at all!!! using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.EntityFrameworkCore; using…