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
votes2
answers40
viewsError "The call thread cannot access this object because it belongs to a different thread."
I have a WPF application that I need to manipulate a textbox. But it gives the following error when running the part of the code that handles the textbox: System.Invalidoperationexception: 'The call…
-
-2
votes1
answer16
viewsUse Datetimepicker as parameter
Good Afternoon! Personal, I’m new in C# and would like to know how I make a query using Datetimepicker in the BETWEEN of a select, below is my code. public static DataTable ListarPrevisoesGrid() {…
-
-2
votes1
answer27
views.NET Core JSON parameter
I’m starting to learn C#, using . NET CORE, and I’m trying to create an API that searches a Mongodb bank. I’ve looked at some topics here, seen some things, but none of the solutions I found worked.…
-
-2
votes1
answer42
viewsHow to compare if an excel text is equal to part of the name of a pdf file in C#?
I would like to start a code that reads a column in an excel spreadsheet that contains CNPJ numbers and compares with PDF file names in a folder. Example: value in an excel cell verses PDF file…
-
-2
votes0
answers17
viewsValidation of the user’s working hours
I need to prevent the user from selecting a longer end time of the previous day than the start time of the current day, when it allows work at dawn. I am doing a timetable validation whenever the…
-
-2
votes0
answers10
viewsHow to change the border color of a Bunifu_textbox programmatically without it leaving the Bordercolorhover property?
I installed a Bunifu UI extension on my windows form C#program. (I’m a beginner in programming) There are some Bunifu_textboxes to which I wish in the Textchanged event to change its edge to green…
-
-2
votes0
answers21
viewsHow to upload with Jquery - Ajax - Webservice
Good afternoon guys, I’m having a hard time uploading a file to the server. I have tested locally and managed to accomplish successfully both on my machine running by the project and on the server…
-
-2
votes0
answers30
viewsHow to fix CS1729 error in this CAD application?
Good morning, I have a problem in a CAD application where it shows the following error: CS1729 error: "Commandmethodattribute" does not contain a constructor that accepts 0 arguments 1-…
-
-2
votes0
answers18
viewsC# cannot interact with Excel
Hello. I am programming Forms with C# in Visual Studio Community 2019. My program triggers Excel and creates a spreadsheet. On my computer everything goes well, but when I installed the executable…
-
-2
votes0
answers19
viewsHow I call a variable declared in a method
Hello, First I wanted to make it clear that I’m kind of new at programming okay?. Well my problem is that I need to do a method where I ask the user a name, then confirm the name, if the answer is…
-
-2
votes0
answers25
viewsput Array of Label objects into Sort numbers?
I’m creating a Label array where the Label Input label creates 12 numeors from 1 to 25, random numbers in ascending order, an Input text where it receives 3 numbers that are added by the user, with…
-
-2
votes0
answers21
viewsWhen to use async and await?
Good morning, I started working with c# and . Net recently on a micro service architecture. I noticed that all methods (controllers, services and repositories) use async/await. No criteria.…
-
-3
votes5
answers2197
viewsHow to create a switch.. case with value ranges?
If a total of days is over 30 and under 60, I do something. If it’s over 60 and under 90 I do something else and so on. How do I do this case? Did the case is the best option?…
-
-3
votes1
answer586
viewsHow to create a dll to use on Asp.net
it is worth noting that I am not programming Asp.net much less c# or something like that. But I had to support a system in Asp.net that consumes a . dll I needed to make a change to this dll. Can…
-
-3
votes1
answer1273
viewsHow to validate a regular expression text not allowing everything in white space?
I need to validate a line from a text file, where I already have part of the expression , but I lack the part where from position X to position Y I have 30 characters that correspond to the type…
-
-3
votes1
answer1703
viewsBring the last five in a row
I have a table of events. And each POS, an event is held, with the Event ID, Date, User and Type. Well, whenever I make a query, I populate an event grid. I would like to know, how to bring the last…
-
-3
votes1
answer61
viewsStarting in the language C#
Guys, I’m starting in C# now and would like to know what I need to do to leave my Desktop systems with the appearance of Windows 8? For example the reference: using Windows.UI I’m expecting some…
c#asked 9 years, 7 months ago Emerson Moraes 323 -
-3
votes1
answer722
viewsHow to search on a dropdownlist?
I have a Dropdown that lists the names of all the banks. I need to create a method in which he brings me a set of results and among them the name of the bank. This database that my list brings (only…
-
-3
votes2
answers63
views"Nullreferenceexeption error was unhandled" when compiling
Follow the code below: public partial class Form1 : Form { public Form1() { button1.Click += Button1_Click; } private void Button1_Click(object sender, EventArgs e) { decimal n1, n2, result; n1 =…
-
-3
votes2
answers159
viewsFetch previous position and two positions back in for loop
In a noose for, i need to take the previous value of the variable i and the value before the previous one. See, subtracting the variable from -1 and -2 does not work. This is not taking two or a…
-
-3
votes2
answers292
viewsHow does the flow of a Web Service work?
I need to develop a web service, and its main idea is client-server communication. But I do not understand how this would be done using the MVC architecture and using the C#language, will have the…
-
-3
votes1
answer369
viewsHow to calculate international credit card IOF?
Has anyone ever needed to implement international credit card IOF calculation function on systems that could give me this help? I need to know the rules of how to calculate. Thank you!
c#asked 8 years, 5 months ago Kelly Soares 1,181 -
-3
votes1
answer454
viewsCode build error in Unity
this asim using UnityEngine; public class PlayerMovement : MonoBehaviour { void Awack() { floorMask = LayerMask.GetMask ("Floor"); anim = getComponet <Animator> (); playerRigidbody =…
-
-3
votes1
answer109
viewsUnity code does not compile
using UnityEngine; using System.Collections; public class Player : MovingObject { public int pointsPerFood = 10; // Numero de pontos cada vez que pegar comida. public int pointsPerSoda = 20; // ""…
-
-3
votes2
answers712
viewsSelect separated by semicolon to xls
I have the following code: var cmd = @"SELECT mt.Id + ';' + mt.Nome + ';' + mt.Cidade AS Resultado FROM MinhaTable mt"; var objectContext = ((IObjectContextAdapter)db).ObjectContext; var result =…
-
-3
votes1
answer231
viewsCompare string[] with string
I tried so: IWebElement descriptionTextXPath = driver.FindElement(By.XPath("html/body/div[1]/div[1]/div[2]/div/ng-include[1]/section/ul/li[1]/div/div/article/h4")); String h4 =…
-
-3
votes1
answer117
viewstcp server chat
Here’s the thing, I have a tcp server for chat. whenever I turn on the server and then close the form, the program gives error because it is in an infinite loop in this part of the code: while…
-
-3
votes1
answer641
viewsValidate CPF using WPF
How can I check if a CPF number is valid using WPF in C#? You need to create some class?
c#asked 8 years, 1 month ago Juninho Silva 29 -
-3
votes1
answer64
viewsHow to leave new form without depending on each other?
Here is the code that opens my Form4: Form4 form4 = new Form4(); form4.Show(); // Aqui um código gigantesco que demora aproximadamente 1 minuto para ser executado. form4.Close(); The problem is that…
-
-3
votes2
answers67
viewsPosting of a website
I would like to know, what is the average amount spent to publish an e-commerce site on the Internet, with databases, domain purchase and so on... and what exactly would I have to do to stay…
-
-3
votes1
answer541
viewsGet the return of a Webapi method?
I have the following code is I want to get a return on the result variable if it is true or false, how could I do it? //http://localhost:1608/api/ApiCidade/deletar/cliente/10 [HttpDelete]…
-
-3
votes3
answers167
viewsHow to delete node in linked list?
How to delete the middle value of a linked list C# Class of Elements; public class NoLista { public float info; public NoLista proximo; //construtor para passar valor ao elemento public NoLista(int…
c#asked 9 years ago WesleyDSantos 76 -
-3
votes2
answers500
viewsHow can I make a C# query in a SQL Server database
I have a project in development in this internship path and therefore I am working on new things. I would like to know how to do in C# a query of data present in SQL Server tables. Sorry if you are…
-
-3
votes1
answer55
viewsHow to access specific information within a View Bag Asp.net
I’m doing a project where we have to create a social network where the user can post something. After doing the post It has to appear what he posted his name and profile picture. For now I have it…
-
-3
votes1
answer445
viewsMessagebox appears twice
I have the following code which is triggered by Handles Button1.Click. Dim X, Cf As Double Dim A, B, C, D, J As String A = TextBox2.Text B = TextBox3.Text C = TextBox4.Text D = TextBox9.Text J =…
-
-3
votes2
answers547
viewsCreate Bank Automatically with Code First
I am creating an ASP.NET MVC application with Code First. This system is trade management software. I’d like to separate the information from each company, not leave it all in the same bank. We…
-
-3
votes2
answers121
viewsWorking with C#; images
So, I’m working on a hangman game, it’s almost ready. Still have to make the images appear via code. And that’s my problem. For example: I want that if the error is 1, the head appears and etc. You…
-
-3
votes2
answers158
viewsI can’t get the value of a combobox with WPF
I can’t get the value of a combobox with WPF. How do I get value? This is the combobox code in XAML. <ComboBox x:Name="cbxCereais" HorizontalAlignment="Left" Margin="145,178,0,0"…
-
-3
votes2
answers672
viewsHow to create folders within the program’s own subfolder?
How to create folders within the program’s own subfolder, even if the user leaves the program anywhere on the computer? All the media I found would be with already determined paths and the other…
-
-3
votes1
answer80
viewsHow to cancel action with key
As it cancels an action, the code below is only one example: Console.WriteLine("Digite algo"); string text = Console.ReadLine(); switch (){ case "comando": // > Aqui seria para cancelar com a…
c#asked 7 years, 2 months ago Leonardo Araujo 55 -
-3
votes1
answer202
viewsObject Orientation in C# - Inheritance
In relation to Orientação Objeto in the C#, have the following doubt: What is the difference between the inheritance of code reuse, of builders, of abstract methods, of superclasses and of…
-
-3
votes1
answer299
viewsShow date field value in a listview in a C#application
Good evening everyone. I need to pull values from a date (Mysql) field and display in a listview in a C#application. It turns out that listview shows the value with date and time, but I need to only…
-
-3
votes1
answer542
viewsChanging content of one form without opening another in c#
I would like to know, how do I change the content of the Form without opening another, when I click Encryption for example, the content changes without opening another Form. How do I do that?…
c#asked 7 years ago Matheus Martins 151 -
-3
votes2
answers1390
viewsAutomatic name generator
It’s the secret I needed when someone clicked a button in a text box appeared a name randomly for example I have a list: Neuro, Food, Capitalism when I clicked the button, the textbox appeared Neuro…
-
-3
votes2
answers89
viewsHow to iterate on a model in C# with variables that have number?
I have a model that was made by another developer where it has several fields like this: . . . Teste() teste = new Teste(); teste.campo_1 = 1; teste.campo_2 = 2; teste.campo_3 = 3; teste.campo_4 =…
-
-3
votes1
answer83
viewsService does not go up
I have a service [file.svc.Cs] but it does not go up, I try to access it with ajax and da not found. Someone knows how to fix it, what could be wrong.? namespace Bob.Servico { // NOTE: You can use…
-
-3
votes1
answer65
viewsSolution for Getrange error when accessing elements outside the list
By calling the GetRange of a list, where it calls 10 out of 10 values from the list at a time, but the following error: Offset and length Were out of Bounds for the array or Count is Greater than…
-
-3
votes1
answer43
viewsHow do I create an installation menu with check box?
I am creating an installation menu with Checkbox, in this menu will have software for installation in each Checkbox, after selecting the Checkbox, will have a button that will run all the checkbox…
-
-3
votes1
answer75
viewsHow to instantiate an Abstract class in C#?
I know the class abstract cannot be instantiated. But I need to call it in Windows Forms and I’m not getting it.
-
-3
votes1
answer519
viewsHow to insert date and time in oracle? via c#
I’m developing a desktop application and everything was working fine until the time I tried to insert the date and time generated by C# into an oracle table. Can someone teach me the query to insert…