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
-
-2
votes1
answer48
viewsI’m trying to make a switch case with more than one variable, but I don’t know how to make it work, can anyone help me?
I want to assign these 4 variables to the switch case however when I will determine the case with the 4 variables it does not accept, says: CS0029 Cannot implicitly convert "bool" type to "(double…
c#asked 3 years, 9 months ago Pedro Henrique Diniz Vieira 1 -
-2
votes2
answers25
viewsC# popular a combo box with variable double
That make a combo box with various height values but my code does not run, the result only adds 1.47: for(double i = 1.47; i <= 2.00; i++) { cbxExemplo.Itens.Add(i); }…
-
-2
votes1
answer34
viewsPopular Datagridview Editable C#
I made a Product Type Editing Form where he has a Usercontrol with the list of Additional Field Types. In the add method everything is right. In Usercontrol has an editable Datagridview where I…
-
-2
votes1
answer23
viewsFailed to install C# extension in VS Code
Hello, I have a problem to install the C# extension on my PC, it is a little old and has 32bits, and when I try to install it says that the extension is not supported. I wonder if you have how to…
-
-2
votes0
answers28
viewsDifference in Sql Server value To C#
Guys I’m converting this formula here to a C code#: declare @decPorcDescuentoTotal DECIMAL(18, 5), @decImporteCuota DECIMAL(18, 5), @decImporteSA DECIMAL(18, 5), @intCantCuotas INT set…
-
-2
votes0
answers11
viewsSystem Properties.DAO MVC and C#
would like to configure the database.... that part does not work insira o código aquicon.ConnectionString = @"Data Source=DESKTOP-A0D6SHM\rafae;Initial Catalog=bancomvc;Integrated Security=True";…
c#asked 3 years, 3 months ago Rafael de Freitas Brigido 1 -
-2
votes1
answer33
viewsI’m in trouble, Nuget packages are all up to date and I have no idea how to fix
Unfortunately I can’t share the code on account of a contract with the company, but if you want the written error: Server Error in Application '/'. Could not load file or Assembly…
-
-2
votes0
answers12
viewsResponsive webforms
Good morning. I work with a website developed in Webforms and I need to make it responsive, is that possible? If possible need guidance on how to do. Thank you very much.
-
-2
votes0
answers11
viewsThe C# extension icon does not appear in the windows folder! What do I do to resolve this?
The c# file extension is not showing on Windows. Since I’m a beginner I don’t know how to fix this. I already checked other files on the computer and the extensions appear normally, only the c# that…
-
-2
votes0
answers15
viewsHow to make a label appear letter by letter?
all right? My question is the following: I wanted my label to appear letter by letter when pressing the keyboard space key, in a kind of animation, and when completing the whole sentence of the…
c#asked 3 years, 2 months ago Rogériosilva 1 -
-2
votes0
answers20
viewsWatermark on minimized windows C#
I am using C# windows application to insert a watermark at the bottom of the screen, and these overrides everything that is open (outlook, word, excel, among others), the watermark remains being…
c#asked 3 years, 2 months ago Elcio Broisler 1 -
-2
votes1
answer26
viewsInterval between commands in C#
I am trying to create an interval between 2 commands. I want to show something on the screen for the user, wait a while and delete the text. I have researched several places and found nothing. I…
-
-2
votes3
answers575
viewsEPSON non fiscal thermal printer does not work in a shared way with USB and LPT
I am creating a system in PHP and we are entering the printing phase with non tax thermal printers. In principle I did not find Epson support for PHP printing and in researches I found the component…
-
-2
votes1
answer714
viewsHow to read text files?
I want to read the lines of a file and then add them to a Listbox. public void subroutine() { string linha; try { using (StreamReader read = new StreamReader(Application.StartupPath + "workers.txt",…
c#asked 7 years, 5 months ago Alexandre Neves 5 -
-2
votes3
answers323
viewsHow to prevent a System.Nullreferenceexception within an if
I’m developing a web application where a photographer does upload of an image. After uploading the image, I will scan the entire Metadata in order to capture some information from directories (Exif,…
-
-2
votes3
answers650
viewsHow to copy a data snippet from a string?
I’m starting in the programming area and I’m developing a serial communication application, where, I receive data strings with some information in which I need to separate them by categories, for…
-
-2
votes1
answer129
viewsHow to use loop for?
How to use loop is that it? I’ve tried every way ever wrong. I’ll express myself better ! What I’m not getting is that this repetition of Metrotiles 1 2 3 4 5 is just one in loope for i , so it…
c#asked 7 years, 3 months ago Carlos Coelho 35 -
-2
votes2
answers46
viewsDoubt with relationships N to N or 1 to N
Given the following scenario. I have 1 user table and a login table, for example. I need to create my domain class that maps these BD entities. In the login table, I get Idusuario. How it looks in…
-
-2
votes1
answer279
viewsc# change source of picturebox
I have a table with 4 Image fields. I put a pictureBox and in the properties Data, in Databindings, Inkei it with one of the fields of the table, the field image1, when executing the program is…
-
-2
votes1
answer55
viewsTurn float or double into date within a lambda
In BD you have a field with a float value, which is actually the number of days from the date 28/12/1800, that the Clarion programming language stores. Well, I have a service REST that is consumed…
-
-2
votes1
answer139
viewsOpen system32 programs by C#
I am trying to run Active Directory from my machine via C#. I can open all other common programs without problem. The program is installed in C:\Windows\system32\dsa.msc, but Visual Studio shows an…
-
-2
votes1
answer419
viewsHow to return a list of a json?
It follows result: {"response":{"numFound":2654,"start":0,"docs":[{"id":"l3ade68b8g5db3b0b3","langID":1,"url":"/ministerio-codigo-de-honra/quao-grande.html","title":"Quão…
-
-2
votes1
answer258
viewsUpdate records linked with Entity Framework?
For example I have a person class and every person can have a spouse if she wants to (Optional). Suppose I have two people registered at the bank: Personal: 1, Name: John, Personal = null Personal:…
-
-2
votes1
answer98
viewsVerification in login form
I am not able to do a check in the database, to make sure that the user exists. Follow the code: private void button1_Click_1(object sender, EventArgs e) { string conexao = "SERVER = localhost;…
-
-2
votes3
answers119
viewsObject is not persisted when using Entity Framework
I’m using the Entity Framework 6 and the Sqlserver. I have an object called category, where I want to persist it in the bank. and when I run this function, it persists the object correctly because I…
-
-2
votes1
answer53
viewsRun user input on a given number
I am making a program that calculates a final note by summing the numbers and dividing them by 4. I would like to add the function of typing as many notes as the users want. This is the code I have…
-
-2
votes2
answers116
viewsIs there any way to simplify this amount of conditions?
I have the following code: foreach (var lote in collection.ToList()) { count++; ushort[] dadosBalanca = new ushort[9]; if (lote.AlvoPasso > ushort.MaxValue) { var subtracao = (lote.AlvoPasso -…
-
-2
votes1
answer75
viewsObject Reference not set to an instance of an Object in return from Procedure
I have a precedent that returns value, but when it arrives in Executescalar() of c# it returns the error "Object reference not set to an instance of an object" The trial is perfect private string…
c#asked 6 years, 7 months ago gabrielfalieri 1,231 -
-2
votes2
answers668
viewsI can’t parse json with brackets in c#
I am using the Newtonsoft.Json.Linq library to parse json in c#. Until now it worked beauty, when I have a string json like this: { 'chave':'valor' } But when I have a json like this: [ {…
-
-2
votes1
answer132
viewsAdd form to subscribe to the newsletter in c#
Viva. I’m developing a website in c#, Asp.net using visual studio. I would like to place a small form where the website viewer places his email to subscribe to a newsletter. I’ve researched ways to…
-
-2
votes2
answers116
viewsProblem to send values of type 11.50 to SQL Server database
I have a problem formatting values type R$ when sending to the data bank 11.50 in the data bank is type 1150. This condition is from the send button to the database has a database management class…
-
-2
votes2
answers231
viewsRouting problems using Asp.net core
When trying to route a core 2.0 application, I can’t get to the controller. public class GetClientController : Controller { LoadClient loadClient = new LoadClient(); [HttpGet] public…
-
-2
votes2
answers463
viewsSystem.Nullreferenceexception error when trying to pass Value from one Form to another Winforms C#
I have in my application a customer registration form and a customer search form. To send values from one form to another I use the code below, I have used this same code in several other forms and…
-
-2
votes1
answer284
viewsFormat numeric field with 2 decimal places in datagridview c#
I need to show a column in the raw weight column datagridview this format 0.00, but I’m not getting, this column is not created in any database, I created the column directly in datagridview, I’ve…
-
-2
votes1
answer42
viewsDelete api not working, do not delete. Stored Procedure in the database is working
This is the API public class DeleteCidade { BancoContext banco = new BancoContext(); public void deleteCidade(int id) { banco.Database.SqlQuery<Cidade>("exec sp_del_cidade", new…
-
-2
votes2
answers615
viewsHow to put a dropdownlist in a cshtml
I need to place a dropdownlist under the following conditions: It will display the name of the City(City Table), but will only record the Employee Code. Using this approach, I can assemble the…
-
-2
votes1
answer53
viewsChanging the select in SP gives error
That is the mistake: System.Data.Entity.Core.EntityCommandExecutionException: 'The data reader is incompatible with the specified 'TreinamentoCrudApi.Context.Cidade'. A member of the type, 'id',…
-
-2
votes2
answers441
viewsError 1 No Overload for method 'Inherited method' takes 1 Arguments
Error 1 No Overload for method 'Inherited method' takes 1 Arguments Code: public void restauraRegistro(DataGridViewRow linha) { try { string codigo = String.Empty; //verifica se e para recuperar com…
-
-2
votes2
answers507
viewsHow to place a url on the web.config
I have a service that calls this service: public async Task<List<Funcionario>> GetFuncionarios() { string url = $"http://localhost:56137/api/GetFuncionario"; var response = await…
-
-2
votes1
answer215
viewsAdd a node to another child node in an XML
I am structuring an XML file. And I need to Add another 'node' to my 'child node'. The function that mounts XML: private string MontarXML(List<Nota> listaNotas) { XmlDocument docConfig = new…
-
-2
votes1
answer94
viewsReturn object between screens - c#
I have a question about returning an object from a screen B to a screen A, for example. I use the form below, hiding the ShowDialog of the base class, making the "new Showdialog" return what I need.…
-
-2
votes1
answer63
viewsDoubt with foreach C#
please. see the code at this link: https://pastebin.com/raw/rDCZQhtf and tell me why the sentence doesn’t come out with the jumbled lyrics; if possible, give me an idea of how to do the same thing…
c#asked 6 years, 2 months ago Vinicius Caetano 89 -
-2
votes1
answer385
viewsCompare lists that are exactly the same
I’m trying to implement a list comparison method that checks if they are equal. It must return true when the two lists passed by parameter are exactly equal (number of elements, elements and…
-
-2
votes1
answer73
viewsReturn data from the Customer
Good morning Personal, I would like to create a function, which returns the requested client, and its data, which are in 3 different tables Clientes, ClientesTelephone, ClientesEmail, I can add the…
-
-2
votes1
answer50
viewsHow do I order a Complex List?
How do I sort a complex list ? I have this list below and I need to sort by Nometype and Nomesubtype: public class Tipo() { public int IdTipo {get; set;} public string NomeTipo {get; set;} public…
-
-2
votes1
answer94
viewsConcatenate string
I want to concatenate the current day with the character "0", but I’m not getting. string diaAtual = DateTime.Now.ToString("d"); string diaFormatado = diaAtual+"0"; I need to do this to insert in a…
c#asked 6 years, 1 month ago Guilherme Wayne 167 -
-2
votes1
answer602
viewsHow to format a label using Stringformat in Xamarin Forms
I am creating a solution where I must display a whole in one <Label />. To do this I’m using the code below: public partial class Home : ContentPage { public Home() { InitializeComponent();…
-
-2
votes1
answer80
viewsClass reference affecting structure
I’m having a little problem and I can’t seem to solve it. I have a class (matrix 0~999) called pTest, she is already instantiated everything straight. After I instantiate I copy a structure that is…
-
-2
votes1
answer147
viewsDate formats API + C#
I developed the system in layers, and I have 2 layers, where layer number 1 is my API and number 2 is where I keep my classes. In one of the classes I have a field of type DateTime. I created a…
-
-2
votes1
answer62
viewsSelection of a non-random number in a variable C#
My question is the following proposed exercise: "Task: Write an algorithm in Visualg or C# that takes two positive integer values (x and y) and tell if x is divisible by y. Let’s focus on the…