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
answer140
viewsField write float to sql server with c#
Good morning, I’m doing an update in a float field on sql server, but I’m not getting this from a conversion error, I tried several ways and did not succeed, I keep getting this error return = Error…
-
-2
votes1
answer108
viewsRotating Razorpdf "locks" on IIS
Friends, I use Visual Studio C# 2015. In an MVC project I am also using the Razorpdf Rotary to create PDF from HTML pages. When I test the application in development environment (localhost within…
-
-2
votes3
answers47
viewsDatetime does not update on Console.Writeline
When I click the button, something is written in the Console along with the date, but the time does not update. Code: private void button2_Click(object sender, EventArgs e) {…
-
-2
votes2
answers409
viewsUsing Dvexpress Gridcontrol
I’m developing an application using Devexpress, where the user clicks on a line in Gridcontrol, when this happens the data of this line are placed in some Textbox, the difficulty has been in finding…
-
-2
votes1
answer462
viewsHow to cache c# . NET information for multiple users?
I have a list of objects, and I would like each user who accesses a page, to add their objects to the cache. And that this cache was worth to the next person who accessed the same url. Example, I…
-
-2
votes1
answer678
viewsdownload and install Microsoft.Speech.Recognition
Someone could inform me the link where I can download this Referral: Microsoft.Speech.Recognition; and if possible help me install it. Thank you
-
-2
votes1
answer96
viewsObject reference undefined, what could it be?
"Undefined object reference for an object instance." Button[,] botoes = new Button[(int)numericUpDownLinhas.Value, (int)numericUpDownColunas.Value]; for(int i = 0; i <…
-
-2
votes2
answers579
viewsException of type System.Nullreferenceexception
Soon after login in the system I try to access a page and the system sends me again to the login page and soon after the login again held happens this exception: "An Exception of type…
-
-2
votes1
answer59
viewsCalculation of days comes negative. Why?
I did that: DateTime dt = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); int dias = (int)dt.Subtract(DateTime.Today).TotalDays; If you make for today(26/01/2018) the result in var dias…
-
-2
votes3
answers578
viewsHow to put two action with HTTPPOST
How to put two controllers with HTTPPOST [HttpPost] public ActionResult Index(string Nomel, string Utilizador, string Password, string PasswordC) { } [HttpPost] public ActionResult Index(string…
-
-2
votes1
answer226
viewsC# - Pass only numbers in a field formatted for currency
I have an application that presents me in a textbox the value of a course enrollment: string mensalidade = string.Format("{0:C}", Convert.ToDouble(leitura["Mensalidade"]));…
-
-2
votes1
answer57
viewsHow to create command line update fields from the board
I have a job to insert, update and delete. The insert and delete are working properly. So, I have a problem with the update that that would be: cmd.CommandText = "Update carros set placa='" +…
c#asked 8 years, 1 month ago Raphael Takashi 1 -
-2
votes1
answer64
viewsC#XML Namespace Control
Hello! I’m building an XML file and it has the xmlns attribute in the parent element, but I don’t want it to appear in the child as is happening below: Follow the code in C language#:…
-
-2
votes2
answers184
viewsCan anyone explain this mistake to me?
I have 2 tables, products and suppliers. And is appearing the following message: System.Data.Sqlclient.Sqlexception: 'The INSERT statement conflicted with the FOREIGN KEY Constraint…
-
-2
votes2
answers46
viewsGo to next statement - C#
I have a if and I need it to be true he gives the message below and soon after he pauses in the system or continues on another instruction. I left the word BREAK to illustrate where I need this…
c#asked 6 years, 6 months ago Deivid Souza 407 -
-2
votes3
answers674
viewshow to count integers in c#
I need help to perform this exercise in c#: Create a program that counts the number of times each element occurs in an integer vector of N. For example, in vector A: A = {4,2,5,4,3,5,2,2,4} 4 occurs…
c#asked 6 years, 5 months ago Bruno Rodrigues 1 -
-2
votes1
answer50
viewsAdd in BD in c#
I’m doing a little project in my college and I started to work with classes in c#, but I’m finding problems when it comes to inserting (my amount of values in Insert does not match values) in my BD…
-
-2
votes1
answer490
viewsGenerate Boleto Itau from a shipping file that is in . txt
I need to generate Itau PDF Newsletter from a shipping file that is in . txt some suggestions to develop the application ?
-
-2
votes1
answer80
viewsDoubt in inheritance c#
I have a conceptual doubt about inheritance, where I have a student and at some point this student will become an employee and this employee he was born in the system as a student and if everything…
-
-2
votes1
answer34
viewsSubstitution within commas in C#
Good morning, everyone. I have the following string: string frutas = "f1,f2,f3,f4,..."; Basically I want him to replace the word that is between 3°and 4°; comma with something. for example: apple…
c#asked 6 years, 3 months ago Luiz Nascimento 81 -
-2
votes1
answer56
viewsReordering Autoincrement in SQL
Eae guys, like I created an ID table with Auto Increment, checking the table ví Bugou, have any SQL commands that reorder from 1,2,3,4 to last? just more for the sake of reorganization. Thank you.…
-
-2
votes1
answer106
viewsPostman call does not enter the controller constructor with parameter
I took a project already developed, but with several problems. In the controller that I am working on, I put a break in the constructor with a parameter and does not enter. If I define one without…
-
-2
votes2
answers1455
viewsError in Datetime.Tryparse
I have a problem with a conversion using the code below: string vcto = "29/01/2018"; DateTime data; Boolean resp = DateTime.TryParse(vcto, out data); if (resp == false) { MessageBox.Show("ERRO NA…
-
-2
votes1
answer137
viewsWant to convert a list<any type> to a list of type Generic?
I want a list of a certain type to become a list of a single type : examples List<usuarios> se transformar em uma List<T> BS : I don’t know if that’s possible Or an Apple List becomes a…
c#asked 6 years, 1 month ago Gabriel Ribeiro 1 -
-2
votes1
answer651
viewsConvert Datetime to Date
I need to compare a date without the time, only ("dd/MM/yyyy") with the database with Linq, but I’m not able to transform the format DateTime("dd/MM/yyyy HH:mm:s") for Date("dd/MM/yyyy")?…
-
-2
votes1
answer63
viewsSelect COUNT > 10K in C# and SQL
I would like to select in records greater than 10 thousand and delete after. select count (FuncionarioID) > 10000 FROM FuncionarioLog; How should I select correctly?…
-
-2
votes1
answer84
viewsI cannot extract a password file using Dotnetzip
I am trying to extract a file called "1.zip" with a random password that I have put... but I’m making a mistake. "e was null". At the point of burning the PC, I’m beginner in C#, I don’t know POO…
-
-2
votes2
answers710
viewsHow to know how many characters there are after the comma c#
I would like to count how many characters there are after the comma. I was using public static string strToDouble(String text) { string aux; if (text.IndexOf(",00") <= 0) { aux = text + ",00";…
-
-2
votes1
answer861
viewsNodejs integration with DLL
I need to make Nodejs read a DLL to create a Rest API. I have the file . dll, but I don’t have the source code, this . dll is in a Chinese C# program. What I want is to use this . dll by creating a…
-
-2
votes4
answers474
viewsGrab part of a string
How do I get just up to the , of the following string: Ninguem ninguem, todos Expected result: Ninguem ninguem
-
-2
votes1
answer477
viewsError when entering monetary value into bank
I am trying to save the value 137421,20 in a table of Sqlserver with a field of type Numeric(8,2). However I get an error with the description: "Parameter value 137421,20 is out of range." I’m…
-
-2
votes2
answers1436
viewsTake variable value in another method
Inside the same file I have 2 methods: public IActionResult OnGet(){ CarregarMenu(); //Gostaria de pegar aqui o valor da variável lcMenuPrincipal Return Page(); } And the other: public static void…
-
-2
votes1
answer387
viewsREMOVE POINTS AND COMMAS VB.NET
Friends, Mysql does not correctly save the values with dots and commas in the currency format! i use VB.net and need a function to remove points and commas, before storing the value in the…
-
-2
votes2
answers57
viewsHow to add AND parameters in EF query
My view sends 5 parameters bool Based on these parameters as I add where and in my query? My code is var query = db.Registros.AsQueryable(); if(model Paramter1) { query = query.Where(x => x.Kind…
-
-2
votes2
answers59
viewsConvert a date from C# (Datetime), which has been transformed JSON, to Javascript Date
When I perform a data search in C#, it returns the DateTime in format "/Date(123456789)/", but I can’t convert to a valid Javascript date. As a: var data = new Date("/Date(123456789)/"); Or: var…
-
-2
votes2
answers142
viewsCode in Employees After Saving Business Layer (V10)
I intend to code the event after recording the business layer of the V10 spring ERP engines, to perform some actions on employees regardless of the origin of the data change. However, the code below…
-
-2
votes1
answer101
viewsSpring V10, Extensibility, Customtab in the "Article Sheet", how to detect and delegate function when the Customtab itself is chosen?
Spring V10, Extensibility, CustomTab, have a CustomTab created in the "Article Sheet", how to detect when the CustomTab is selected and assigns a function? When I search the examples, I only find…
c#asked 5 years, 1 month ago José Mendes 1 -
-2
votes3
answers97
viewsNavigation.Popasync() does not work when used as an option to exit the application
I have a one-screen app, a "Contentpage". I can’t get out of the app with "Popasync()". I’m debugging on a Samsung J6 device. // página instanciada MainPage = new NavigationPage(new Inicio()); //…
-
-2
votes1
answer819
viewsBoletos.Net com . NET Core(v2.0) C#
I am trying to use Boletosnet to generate a boleto and later a PDF of it, but when I try to use any method of the library, an error is shown "Reference to type "Control" declares that it is set in…
-
-2
votes1
answer71
viewsDenied permission when creating folder
I was creating an application that needs to create a folder in System32 or in the windows folder itself, only it needs permission and error:'O acesso ao caminho 'C:\Windows\pasta' foi negado.' Does…
c#asked 4 years, 11 months ago João silva 79 -
-2
votes1
answer28
viewsError adding list in "Checked List Box"
Adding the name of some files in a folder to a "Checked List Box" does not show anything in the List Box. ListBox mylist = new ListBox(); DirectoryInfo d = new DirectoryInfo(@"C:\Program Files…
-
-2
votes2
answers716
viewsHow to check if a string contains a word
I wanted to know how to verify if a string exists a word, for example, I have two conditions for a situation the professional string can contain Medico or Paisanamedico. I wanted a north or way to…
-
-2
votes1
answer39
viewsWhy is the dot replaced by a comma when sending the c# Sqlcommand to the database?
Note that in the first image the value is still correct: 150.45 The problem is that when sending the command to the database the point is replaced by comma, in the second image I captured the…
c#asked 4 years, 8 months ago Matheus Castro 13 -
-2
votes1
answer881
viewsRead data from a column through C#
I have a postcode and divided into 2 variables: the first, where the first 4 numbers appear and the second where the last 3 appear. Ex.: 4300-234 - first = 4300; second = 234. I have a table in the…
-
-2
votes1
answer31
viewsExtract Specific Files with C# Windows Form
Boa Tarde Personal, I have a question and I hope you can help me. I added to my project a ZIP file with files inside. I need to compile this zip file along with the program. After compiling the…
-
-2
votes1
answer40
viewsWhat’s Mathf.abs for.
I am programming in Unity and I see many people using it, and sometimes I even use it in my scripts but I don’t understand exactly what it does "returns", please explain to me?
-
-2
votes1
answer98
viewsHow to use two sensors in the Arduino and show the data in a C#application?
I have a code in the Arduino where has 1 ultrasonic sensor that measures the amount of liquid, and in a tank a flow sensor that measures the amount of water consumed. In the other code C# I have an…
-
-2
votes1
answer1304
viewsHow to read attributes of a line in XML?
I have an XML file with the following structure: <?xml version="1.0" encoding="ISO-8859-1"?> <FIELDS> <FIELD attrname="CO_UNIDADE" fieldtype="string" WIDTH="31"/> <FIELD…
c#asked 7 years, 6 months ago Italo Rodrigo 4,344 -
-2
votes0
answers21
viewsBypass automatic conversion to utf-16 on C#
I need to send data to a webosocket Handshake, however, it does not seem to recognize the exhaust sequences in utf-16 generated by c#. the correct string is contains " X02 x00" but when compiling…
c#asked 3 years, 10 months ago Sloan Moura 12 -
-2
votes1
answer89
viewsSql server error on the hosting server
I’m making a website, through the Visual Studio template. With me it works, but when I go up to the server and when I soon, it gives me the error below. I used as template the SPA and Visual Studio…