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
votes4
answers65
viewsAfter error in database insertion through c# I cannot insert remaining lines
Hello, When executing list in . csv and inserting them in PROC by C# error is given on one of the lines, but I would like that after the error the execution continues, follows part: Try { Reader =…
c#asked 7 years, 8 months ago rock.ownar 355 -
1
votes0
answers433
viewsHow to print images and text (Coupon) in C#ELGIN I9 thermal printers?
I have received a demand to implement a program with the ELGIN printer, version I9. This program will be similar to those used in shops, markets where you have to print that coupon with the…
-
1
votes0
answers20
viewshow to replace a character in the textbox, via the cursor position
I have a textbox with the following value "00:00". I want that when the user type a number, the 0 will be exchanged for that value that the user typed. for example: if my cursor is in the second 0…
-
1
votes1
answer125
viewsDifference between Server Object Explorer and Server Explorer
I would like to ask you a question. A question that I could not answer anywhere. I wanted to know the difference between the Object Explorer and the Server Explorer. This doubt arose after I…
c#asked 7 years, 8 months ago Daniel Júnior 11 -
1
votes1
answer48
viewsHow to download more than one Chromedriver file without asking for download authorization
I’m trying to download more than one file by Chrome and keeps popping up the permission message would have some way to automatically accept…
-
1
votes1
answer49
viewsWhy use local functions?
Recently it was introduced in the C# 7.0 local functions, where you can create unsigned functions or methods within other nested form methods/functions. int MinhaFormula(int x, int y) { int y = x +…
-
1
votes0
answers148
viewsDoubt on How to pass selected lines from one datagridview to another
good evening.I am developing a Windownsform application with C# and mysql, I have some doubts about how to pass data from one datagridview to another. Datagridviews are found in different forms. I…
-
1
votes1
answer82
viewsImplement Dictionary as C#interface
I am trying to set a Dictionary on my interface, but it is saying that the main class did not implement Dictionary. Interface.Cs public interface IItem { event Action<string, string, string,…
-
1
votes0
answers35
viewsTreat Customerror ASP.NET
Good morning, I was having an error publishing the Runtime error site, I created a blank ASPX page and added the tag to the web.config <customErrors mode="On"…
-
1
votes0
answers10
viewsNew XML file when change a AXML file xamarain for Android, Why?
I need change a AXML file in an old Xamarin.Android APP, I’m not an expert, I have just this one APP and I don’t change it in long time. When I changed the AXML file, Visual Sutdio created a new XML…
-
1
votes0
answers61
viewsStart Async function
Good morning guys, I don’t have much knowledge about async, and maybe someone could help me with this: public async Task<ActionResult> IndexAsync(CancellationToken cancellationToken) { var…
-
1
votes2
answers121
viewsHow to format decimal numbers using Fluent API in the Entity Framework?
How to create a formatting with precision 10,4 (4 decimal places) to save decimal data to SQL Server? This format description goes inside the modelBuilder, however, I have not found any code already…
-
1
votes2
answers485
viewsFunctionality of ! Ispostback
What is the real usefulness of this if(!Ispostback) of the page_load of the aspx pages? protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { //codigo } }…
-
1
votes3
answers219
viewsCheck function existence in C#
How can I verify if a function exists in C#? I think I have to use some kind of reflection, but I don’t know much about it. Is there any way to get the function’s list of arguments, if it exists?…
-
1
votes1
answer682
viewsHow to convert 32(24) bit color to 16 bit?
So guys, I’m in big trouble rsrs, I’m creating an editing tool for a PS2 football game. And this game has two "systems" of colors, which are they: The "normal" RGB that is; R: 0 to 255, G: 0 to 255,…
-
1
votes1
answer743
viewsUpload to Drive
Personal have the following code, which opens the google consent screen, where the user authorization is made and generated an authentication token: public async Task<ActionResult>…
-
1
votes1
answer250
viewsC# Postgree Connection Error - Locaweb
Dear I have a webservice consuming postgreesql data and when I try to connect with the base after posting. The host I’m trying to use: "servoripanema.no-ip.info" Npgsql.Npgsqlexception: Failed to…
-
1
votes1
answer96
viewsAsp.Net MVC Enable breakpoint instruction Javascript
When running the system it does not respect breakpoint and displays this message as shown in the image. According to this microsoft documentation should work like this.…
-
1
votes1
answer79
viewsConvert View to Controller Values
I need you to byte[]Descricao, when sent to my view displays the text as string for the user to manipulate within the TextArea, when I click in saving need to be converted again to byte[] for that…
-
1
votes1
answer637
viewsChanging values in Modal - C# MVC Javascript
I have the following javascript code in my project that picks up attribute values when the user clicks the class button rename and calls a modal: <script type="text/javascript">…
-
1
votes0
answers26
viewsHow to implement the "Where" clause as "in" and "not in" in c# Linq?
I have the following querys: Select * from Processos where idProcesso in (1,2,3,4,5); Select * from Processos where idProcesso not in (1,2,3,4,5); Where idProcess is a column with data type int. I…
-
1
votes1
answer145
viewsHow to create an integer variable in hexadecimal?
I am trying to create an integer variable in hexadecimal, but an error occurs saying it is not in the correct format. [DllImport("user32.dll")] public static extern short GetKeyState(int vKey);…
-
1
votes1
answer545
viewsASP.NET - Access Dropdownlist item attribute in Code Behind
I have a DropDownList in which I add items as below: var item= new ListItem("Texto do Item", "Valor do Item"); item.Attributes.Add("NomeAtributo", "ValorAtributo"); The DropDownList is rendered on…
-
1
votes1
answer476
viewsRadio Button on C#
Hello, I have a registration screen and save everything ok according to the data filled, but when I click the change button returns all values entries, but does not return radio button selected as…
-
1
votes0
answers31
viewsHow to separate a string when a given word is started?
String: string str = "1234 5678 9012 ID: 123456789" How can I separate the string when the word "ID" is found? Ex: string[] formatted = {"1234 5678 9012", "ID: 123456789"}…
c#asked 4 years, 9 months ago Josias Matheus 111 -
1
votes1
answer133
viewsConvert string to Datetime with . Parseexact()
I am trying to receive a string typed by the user in the format "dd/MM/yyyy hh:mm", but whenever I use a date above 12:59 the following error occurs: System.Formatexception: 'String '25/06/2018…
-
1
votes2
answers1601
viewsUse more than one template in View - C# MVC
I have two tables in my bank: Celular and Marca. To register a mobile phone, I need to select a brand for it, ie two models in a view. Like I do to make two Models are accessed in the same view?…
-
1
votes1
answer48
viewsUnderstanding how it works to convert an Object to Json
I have a PUT route that receives a Json in the variable "edits" and from what I understand, in C# it ends up being an object. I was researching a way to receive the file correctly and through some…
-
1
votes1
answer86
views -
1
votes2
answers328
viewsFilling out a form’s textbox with information from a datagridview
I have a datagrideview in a form, and I need that when I click the datagridview cell it fill two fields in another form. As I show in the image below. also follows my code public partial class…
-
1
votes1
answer60
viewsError Calling Up Report
I have an error below, when I call a report, which has a query in the database, I am not able to solve. Give a look at the result has nothing to zero Follows the code: SELECT SD.D2_DOC,…
-
1
votes1
answer100
viewsInvalid Parameter when Initializing Process() running Git ssh in C#Console Application
I’m trying to make a C# Application Console with some command options to run in Git ssh. Git’s ssh executable is in the following path: C:/Program Files (x86)/Git/bin/sh.exe, and I’m trying to run a…
-
1
votes1
answer260
viewsDefaultview.Rowfilter filter by date filter
Good afternoon, I am filled a Gridview, but when I am going to perform the filter, it informs me the following error "Object reference not set for an instance of an object." The field I’m trying to…
-
1
votes0
answers769
viewsRemove accents and symbols with regex
I need to remove the accents and replace the symbol & of that string: "Industry and Trade of manufactured products & aggregates, wells, manufactured and 1º ...", but it doesn’t work properly…
-
1
votes1
answer56
viewsField within a variable dynamically using array
Here I have code: byte[] Imagem1 = null; byte[] Imagem2 = null; byte[] Imagem3 = null; byte[] Imagem4 = null; byte[] Imagem5 = null; byte[] Imagem6 = null; How can I declare bytes[] variables inside…
c#asked 7 years, 7 months ago Matheus Miranda 5,375 -
1
votes0
answers50
viewsImage disappears when running the project
Good time people, I’m having problems using an image using WPF, I’m trying to use Uri to instantiate the image and run the project, but an Isfrozen error is false and does not run the project, using…
-
1
votes0
answers23
viewsProblem with go to Definition
I have a problem that arose a few days ago. I have been working on a project for 3 years. From about 10 days to the present, when executing the GO TO DEFINITION command over a given source code, a…
-
1
votes1
answer19
viewsMongodb driver C# Index not used
In Mongodb: db.estr.createIndex({_id:1, Atualizar:-1}); In C# var a = await db.dados.Distinct(x=>x.codigo).toListAsync(); var b = await db.estr.find(x=>!a.contains(x._id) &&…
-
1
votes1
answer960
viewsError The type or namespace name 'Model' could not be found
I’m getting the error message below on instruction @model FuncionarioModel Error: The type or namespace name 'Funcionaiomodel' could not be found (are you Missing a using Directive or an Assembly…
-
1
votes1
answer61
viewsHow do I stop an array through a function?
I am writing a code in Unity you need to pass several values through a function, I decided to use the array in the function statement, however when I try to recover the values of the array all of…
-
1
votes2
answers253
viewsHow to store multiple user names in one variable?
I have a form, and in it I make a query in the database: private void Consulta() { var dataCom = Convert.ToDateTime(label1.Text).ToShortDateString(); var conf = $"select * from data where data_venc…
-
1
votes0
answers34
viewsHow to access Device through Browser - ASP . NET MVC
Good afternoon to all, Staff I am with the following question, how can I access a device/device connected to customer usb through an application made in Asp . Net MVC? The idea is to access a…
-
1
votes1
answer34
viewsGetting date from a C#website
I am developing a program in C# that allows a click at a certain time chosen by the user. For now the program clicks subtracting the time chosen by the user with the local time, but I discovered a…
-
1
votes1
answer819
viewsOpen Modal by code-Behind
I have a modal, #myModal, and I would like that when I click on the button, I had a condition and that if it entered Else, it would open the modal. I created this code in javascript: <script…
-
1
votes3
answers517
viewsTake information from a Website and Label it?
I want to navigate to the Site and get the Current Bitcoin Value to Insert into a Label. This was my attempt that clearly didn’t work... private void Form1_Load(object sender, EventArgs e) {…
-
1
votes1
answer23
viewsRelationship 1:N using EF using Data Annotationion
I’m trying to map between these two classes, where in championship I have a list of all stages related to the championship Follows the classes, [Table("ETAPA")] public class Etapa { [Key] public int…
-
1
votes0
answers932
viewsTimer - run at set time
I am developing a Windows Service, where every day at 18:00 hours, I need an event to be triggered. So I’m using the class Timer. I managed to trigger an event by defining the property Interval,…
-
1
votes1
answer29
viewsHow to include if command to add a new object to a list?
I use this command to save a new pessoa a list: class pessoa { string nome; int idade; int sexo; } List<pessoa> pessoas.add(new pessoa() { nome = "italo rodrigo", idade = 34, sexo = 1 }); To…
c#asked 7 years, 7 months ago Italo Rodrigo 4,344 -
1
votes0
answers18
viewsIs it possible to create a button in Visual C# via a command line?
Good afternoon to you all. I would like to create command line buttons in Visual C#. This is possible? My final idea is to create a kind of spreadsheet with 10x10 buttons (total 100 buttons). Doing…
c#asked 4 years, 6 months ago Luiz Nascimento 81 -
1
votes1
answer154
viewsHow to simulate mouse clicks in a background program
I’m like a problem to use the functions SendMessage and PostMessage in C# to simulate clicks mouse in a minimized program (in the background). I used this code but it didn’t work, I believe it’s the…