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
answer60
viewsAsymptotic analysis of the best and worst case
I want to know the best and worst case of my code. I still don’t quite understand how to do these types of analysis in a code and wanted to have some help to know how to identify. I understand that…
c#asked 3 years, 8 months ago fusionhelhotmailcom 1 -
0
votes0
answers35
views"Method Not Found" and "Method Not Allowed" using Webapi and POST
I am developing a picking software, where the user from a sales order (order) creates a picking list (which contain the products that the warehouse employee will pick up for later transport to take…
-
0
votes2
answers44
viewsC# - Adding indices from an array and filtering for common results
I need to create a for that goes from 10 to 99 and then I need to print inside an if all the values that we summed up resulting in 11 (for example 56 = 5 + 6 = 11) So far my code is like this class…
-
0
votes0
answers11
viewsConsole does not set floating point
The variable of type float fish is reading the console, and when I put a value of 12.4, for example, I have it print the same variable, but even forcing a conversion to float, the output on the…
-
0
votes1
answer90
viewsPicturebox and datagridview
Guys I’m in need of help, already managed to upload images to comics, now I have the following problem: I placed this code to select a datagridview line and fill in the respective fields.…
c#asked 7 years, 6 months ago Daniel Sousa 49 -
0
votes1
answer51
viewsError with Android Style
I am unable to compile my project, I get the following error <type> attribute is required for <item> Here’s my xml style. <?xml version="1.0" encoding="utf-8" ?> <resources>…
-
0
votes1
answer319
viewsUpdate Chart with data from a column in Gridview
I have in my project a Gridview where I manually insert data in the last column (index 7) and a Piechart that must be updated according to this last column, however, as much as I can get the data…
-
0
votes0
answers22
viewsError when trying to Add MVC Controller with views, using Entity Framework
Hello, when I try to create a Controller gives the error attachment. Does anyone know how to fix it? Thanks.…
-
0
votes1
answer1402
viewsReceiving System.Web.Mvc.Webviewpage<Tmodel>.Model.get returned null
I am getting a null reference error and do not understand why. Follow the error: System.NullReferenceException: 'Referência de objeto não definida para uma instância de um objeto.'…
-
0
votes0
answers14
viewsWhen we use and why we use (){ } in C#
I’ve used it a few times, but I hate doing or writing or wearing something I don’t understand. I see codes with "using(){}", but I can not understand well this syntax, the reason why I use and a…
c#asked 3 years, 7 months ago Dev Juniot 1 -
0
votes0
answers97
viewsIf’s condition is not accepting in Asp.net mvc Razor
I want to update on one condition, however, you are updating the data without seeing the if condition using System; using System.Collections.Generic; using System.Linq; using System.Web; using…
-
0
votes1
answer51
viewsCreate Actionfilter for "Anonymous" login
I looked it up online, but I couldn’t find the answer to what I wanted. I have the simple code below that checks if the user is authenticated or not in my Actionfilter public class FiltroLogin :…
-
0
votes1
answer18
viewsHow to do an event in more than one box/button/label at the same time?
On Vb.net I used a command that was: private sub txt1_LostFocus(object sender, EventArgs e) handles txt2.text, txt3.text sender.text = Ucase(sender.text) end sub This caused all text boxes to be in…
-
0
votes1
answer32
viewsCalling method by string command
I am a command bar in an application with several functions present in buttons in a Ribon. A large part of these functions must be able to be executed by means of commands, for example: Botão…
-
0
votes1
answer326
viewsUsing methods from a project written in C++ in C# (Same Solution)
Hello, I need to consume methods written in C++ in a project written in C#, within . NET (both) and that are contained in the same Solution (as shown in the image below) I tried to compile the…
-
0
votes2
answers205
viewsSort files by name c#
I have several files like this: - C:\ByMe\SOLUTIONS\Dictation1\Database\Updates\2017\2017_04\20170405_TR\1_CREATE_TABLE_BMTApprovalGroupExam.sql -…
-
0
votes1
answer34
viewsError Nothing to commit (create/copy files and use "git add" to track)
So, I’m starting in git and I’m finding it difficult to commit a file. I did the whole step by step, created a repository and I can get to the add part (git add *), but when it comes to doing commit…
-
0
votes2
answers756
viewsHow do I break a line to send an email to a user with HTML?
I send an email to the user who enters the application. I would like to know how I do the line break, so that it stays the way I wish. Below the code I use: private void newUserEmail(string email,…
-
0
votes2
answers36
viewsSearch WEB date only
I need to search the date acts from the Internet, in the code below the return is the date, hour, minutes and seconds. public static DateTime GetNistTime() { var myHttpWebRequest =…
-
0
votes1
answer31
viewsStore information per logged-in user without using Session
I would like to know how I can store user information individually without using Constants and Session to be accessed by my data access project? It used constants but the application was transformed…
-
0
votes1
answer42
viewsPass values from a Usercontrol to the parent Form
I own a Form main and 4 UserControl with some TextBox, those UserControl is inside this Form and my intention is to take the values of the fields of these UserControl from a button on Form main, for…
-
0
votes0
answers22
viewsin C# I would like to display Currency in Mozambique’s Metical format
hello, in C#, I have my fields displaying in BRL currency format in Real symbol >R$12.00 would like to display in Metical 12.00MT symbol format. someone can help me in this exhibition? I’ll have…
c#asked 3 years, 5 months ago Alex Rodrigues 19 -
0
votes1
answer63
viewsHow to capture several exceptions with C#switch?
I want to capture some exceptions using try-catch and switch. I made a few attempts, but it didn’t work. For example: try { //tarefas... } catch (Exception ex) { switch () { case PrimeiraExceção;…
-
0
votes1
answer44
viewsProblem with for and string. Remove
I’m having a problem with a program that I did for encryption and decryption from a hash, don’t judge how it works, I did it while it was very tied. What is not working is the Decrypt, I believe it…
-
0
votes1
answer41
viewsASP NET Core Dynamic value "Route"
Can the route parameter be dynamic? for example I want that when Uf is "sp" I put sao-paulo, and so on with the other states. Because then when I load the aciton it loads the url as I reported it.…
-
0
votes1
answer45
viewsAccess an array’s Indice value
How do I get the value of the array’s input in each interaction, without having to place the Permissionusuariofilter.Userpermissionid[0] dynamical and non-static Dice. I need the class to stay that…
-
0
votes0
answers27
viewssum the values of the repeated names in Datagridview
Hello, folks all right, I have an application where I add the items in Datagridview, however I want to add the volume values, the lines that are with the same name, I want to create a variable to…
c# sql-server entity-framework winforms visual-studioasked 3 years, 4 months ago Mecleudio Queiroz 31 -
0
votes0
answers32
viewsChange BD Sql Compact path in Setting.Designer.Cs C#
I made an application in which the sql file Compact (.sdf) will be allocated on a network PC and I wanted to have the option to change the path of the database whenever I want. For all Datagridview…
-
0
votes0
answers11
viewshow to organize an 8x4 rectangle table so that it is possible to add row by row of 4 columns
I’m having doubts about how to add a line of 4 colors, line by line: As shown: At each push of a button. using System.Collections.Generic; using System.Linq; using System.Text; using…
-
0
votes0
answers10
viewsBLE plugin limit Bluetooth connection by distance
need to perform a bluetooth connection of an app in Xamarin with another device. I found a plugin called Plugin.BLE. The point is this, the connection between the 2 devices should occur only if both…
-
0
votes0
answers16
viewsPublication Razor ASP . NET MVC with problem
When I publish my web application in IIS via Visual Studio Community 2019, direct from my workstation, at the moment I access it through the browser of the attached message. But when I delete the…
-
0
votes1
answer16
viewsLoad Visual Studio Projects to Vscode
Good night to you all! I always developed my web applications in C# with Visual Studio, but now by necessity I need to go to Visual Code. Could you give me some tips on how to use Visual Code in…
-
0
votes1
answer36
viewshow to validate for name not to receive numbers or special characters c#
How do I validate the name attribute where it does not allow numbers or special characters ? I did so but it’s not working [Required(ErrorMessage = "O campo nome é obrigatório!", AllowEmptyStrings =…
-
0
votes0
answers40
viewsLINQ not recognizing method that returns a Boolean
I’m having this mistake when I try to perform a query with the Entity within a Iqueryable. "LINQ to Entities does not recognize the method 'Boolean Checkpast values(Int32)' method, and this method…
-
0
votes0
answers14
viewsProblem with Encoding Losing Accent
I get a file (*.txt) that comes as default ANSI encounter. But every time I read the file it returns me "?" in all characters that have some kind of accent or even the "ç" itself". Ways I have…
-
0
votes1
answer51
viewsReturn in JSON
You guys, a doubt. Making an API on NET 5 and using EF, when I make a query for related data the return on JSON gives error 500. // GET: api/Estadoes/5 [HttpGet("{id}")] public async…
-
0
votes3
answers1812
viewsC# - Object reference not defined for an object instance
I have this mistake in my code: try { localhost.Agendamento a = new localhost.Agendamento(); a.Cliente.Cpf = "1909009921"; a.Servico.Cod_serv = 1; a.Data = Convert.ToDateTime("11/02/2017"); a.Hora =…
c#asked 7 years, 5 months ago Luiz Didier 71 -
0
votes1
answer31
viewsDuplicate Username - Entity Framework
I am in an ongoing project, today has already been installed the Entity framework. But what happened, it doesn’t let add users with the same name, which makes no sense, since they can have equal…
-
0
votes0
answers12
viewsHow to insert text box over image.Svg in Xamarin. Forms?
I have an extension file SVG, which I will use as a structure for my layout, I was able to display the image using the extension Ffimageloading.Svg.Forms, I would like to insert on this image fields…
-
0
votes1
answer122
viewsFill a listbox with predicate<string>
I am studying DDD and Webapi and as I find difficulties, I research and try to solve. Of course, sometimes I come across simple things for some here and I can’t get it right away. Sometimes I even…
-
0
votes1
answer286
viewsUpdate multiple form files after jquery/ajax post request
I have two requests post in the form, one inactive and another activates a register, as they are equal I will display only one to exemplify: function inativarCadastro(cod) { $.ajax({ url:…
-
0
votes2
answers416
viewsActive Process when I close the C# WPF program
I have an application in C# it works normally, but when I click the button to close, it closes but it does not stop ... I think it is in some kind of background, ie your process remains active! and…
c#asked 7 years, 5 months ago Bruno Silva 400 -
0
votes1
answer38
viewsRemove columns with Null from Datagridview
I already used "IS NOT NULL" in Query’s Select, but it removes the entire row and in this case, I would like to remove the column only. This table has more than 70 columns and Null Fields may vary,…
-
0
votes0
answers18
viewsHow to close window press Process Start in c#automation?
Hello I am doing an automation and for that I needed to open the Power Options window in windows. For this I used the method: Process.Start("Rundll32.exe", "shell32.dll,Control_RunDLL…
-
0
votes0
answers82
viewsAccess child class properties C#
Using code-first generated the class: namespace take8.Models { using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using…
-
0
votes1
answer938
viewsdisplay data from a mysql database column under label
How to select a die from my table column and display it in a label? EX: id = 10 -> Banana Select * From tabela where id = 10 label.Text = Banana MySqlConnection conexao = new MySqlConnection();…
-
0
votes3
answers35
viewsInstance of a certain type cannot be traced because another instance with the same key value for {'ID'} is already being tracked
I am trying to update an entity of mine in the bank but without success, I visualized other posts of the subject, and their solution seems not to be serving for me. I am using Entity Framework Core…
-
0
votes0
answers14
viewsRemote database access c# with SQL server
Personal greetings I have a c# application using the SQL server database I would like to know, after configuring SQL server for remote access What connection string can I use for on the client…
-
0
votes0
answers12
viewsHow to move multiple folders from one directory to another in C#
Good morning I already have a notion of how I will move 1 file or 1 folder at a time in C# to different directory but I am not able to do when it is a large group of files or folders and the idea is…
-
0
votes0
answers14
viewsDOCUMENT VERIFICATION ON ANOTHER WEBSITE
Hello! I would like to do an integration to check a CNPJ. On my site, the user would have to put their CPNJ, UF, entity name, city and purpose. And, for confirmation purposes, I would have to do a…