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
answer344
viewsError while editing Viewmodel data
In project I have a Viewmodel and inside it my models and everything. What happens is that I am trying to edit the data that is already saved in the database. I can bring the edited data from the…
-
0
votes1
answer285
viewsPlugin for manipulating images with C#
i would like to know if there is any plugin that facilitates image manipulation, for example, add a photo as a component and can change scale, position and that accepts alpha transparence among…
c#asked 7 years ago Tulio Calil 143 -
0
votes3
answers5991
viewsConvert number to string to two decimal places
Imagine a string with the following value: 12,126456 How do I convert the string to 12.12? I need to convert, using C#, so that the final string has at most two digits after the comma. tried the…
-
0
votes1
answer3703
viewsHow to get the encoding type of a file?
Follows code: string text = File.ReadAllText($@"{pathname}", Encoding.UTF8); I have several txt files with different condition. Because here shows no special characters, because different encoding.…
-
0
votes0
answers677
viewsDropdownlist with data from an Enum
I need to make a Helper where I pass an Enum and it mounts a Dropdownlist based on all values of Enum, I tried to do as follows: C#: public static HtmlString DropDownListEnumFor(this HtmlHelper…
-
0
votes3
answers3861
viewsHow to replace the comma
I was wondering how can I replace the comma for a period. Example: I have the following number 2.32 wanted it to be 2.32. How can I do that? I’ve tried using the…
-
0
votes2
answers5083
viewsConvert Datatable to List C#
I need to convert the contents of DataTable for a List, I’m new to C# and I don’t know the syntax. public List < VoCliente > ConsutaCliente() { DataTable tabela =…
-
0
votes0
answers470
viewsEntity Framework 6: Connection Error
I created a project with Entity Framework 6 and another Console Application type project, containing the following connection string in the App.Config file: <connectionStrings> <add…
-
0
votes1
answer4546
viewsValue of the first cell of the selected line datagridview
Friends good night. I am having difficulties in processing the data of a datagridview, I need that when the user clicks on the line, it is assigned to a variable, the value of the cell, of the first…
c#asked 8 years, 5 months ago Thomas Erich Pimentel 3,059 -
0
votes1
answer210
viewsConvert "date and time" to "date" in C#
I need to convert "date and time" to "date" in C#, keeping the Datetime format (without converting to string). In the code, I am converting an object to datetime, but I need to remove its time also…
-
0
votes1
answer115
viewsThe WFA1.exe file is not a valid (portable executable) PE
Hello, I’m trying to use the update function of visual studio using Click Once, but on some computers, when starting to install the file, it crashes and displays an error message. This problem only…
-
0
votes1
answer147
viewsHow to Save Radiobutton to Oracle
How do I save only the marked Radiobutton? Images below what I did. He’s saving one value, even though I marked the other.In my database I have to create a single field to save any of the…
-
0
votes1
answer1302
viewsDatetime UTC Opening hours NF-e
How can I change the time zone of a type variable DateTime? The idea is to make a routine where the user does not need to change the time of the computer to perform NF-e transmissions, but is…
-
0
votes0
answers31
viewsWhat is the difference between a {get; set;} property and a public variable?
I’m programming in C# and I always see them use propriedades allowing to take and set the value of the variable, but what is the sense of this? When you let it just take the value or something I…
c#asked 7 years ago underfilho 600 -
0
votes1
answer875
viewsLinq - Relationship with 3 tables
Good morning. In my project (C# MVC), I need to make a query with three tables, being: Tabcolecao 1 - N Tabvolume and Tabvolume 1 - N Tobacconist Example: I need to present the View as follows: The…
-
0
votes2
answers580
viewsSend Angularjs object to C#API POST
I am not able to save the data registered in a form in the SQL Server database. The structure is as follows: The class: public partial class EMPRESAS_PARTICIPANTES { public int ID { get; set; }…
-
0
votes3
answers1454
viewssending email by smtp
I made a class that has the following code to send an email: try { WebMail.SmtpServer = "smtp-mail.outlook.com"; WebMail.SmtpPort = 25; WebMail.EnableSsl = true; WebMail.UserName = "meuemail";…
-
0
votes1
answer86
viewsconnect to multiple sqlserver databases
Good evening, I’m developing a system in MVC 5 and c#, I have two SQLSERVER database, one for Development and one for Production. I ask to know how to configure Webconfig to accept these two…
-
0
votes0
answers27
viewsTwo Form error on an Asp.net page
I have a problem with the Asp.net form. My master page has a form, and the daughter page also has a form that passes some javascript actions to add a product to the cart. Only when I click any…
-
0
votes1
answer116
viewsXtragrid - Grdview - Click event
Good morning, you guys. How are you? I’m having a hard time implementing an event by clicking on Gridview. I’m using the components of Devexpress, Xtragrid.Gridview. Well, I’m adding the event:…
-
0
votes1
answer695
viewsDownload all files from a remote FTP directory
I would like your help as I am making an application that downloads files from a remote ftp directory. Could you pass the code to implement in C# please? Connect to remote FTP and copy all files…
-
0
votes0
answers1073
viewsReport Viewer with parameters. C#
Hello! The report (.rdlc) is successfully returning data with the help of a datatable, but I need to put parameters and it doesn’t work. Follows the code: private void frmReportTeste_Load(object…
-
0
votes1
answer58
viewsHow do I mount a List or Ienumerable array in the Controller and move to View?
Good evening! I made a request to my webapi to search for data to use=it in a DropDownlist @Html.DropDownList("Id","Descricao"). In My controller, I can pull Webapi results in collection, I treated…
-
0
votes3
answers1677
viewsHow to disable Submit from a form by "Enter" - c# MVC
I am developing a web project in c#, and for Forms I am using the Html.BeginForm. How to disable Submit by pressing the key Enter? Can do without javascript?
-
0
votes2
answers85
viewsChange column data
How can I change column data? I wanted to change some bits to false but I don’t know how. using (SqlCommand cmdadd = new SqlCommand("INSERT into Usuarios (Cadastro) VALUES (@Cadastro)",…
-
0
votes1
answer274
viewsEntity Framework Code First. How to generate two banks from two projects, with the second project using classes from the first
Personal talk! I have a question regarding Entity Framework 6. I have two projects A and B, A being a shared core. It has some classes as Parents, State, City, Address etc. In Project B, I have some…
-
0
votes1
answer323
viewsWait 3 seconds when click close console
How can I make you wait 3 seconds to close the console? Thread.Sleep(3000) I just don’t know how to apply to the console. Can you explain? He would press the X button to close the console and wait 3…
c#asked 7 years ago user92401 -
0
votes0
answers33
viewsDelete a directory recursively
Looking at Microsoft documentation on the method System.IO.Directory.Delete(path, bool);i noticed that adding a true boolean in the second parameter makes it recursive. In my case, the folder I will…
-
0
votes2
answers1142
viewsHow to Increase Time Timeout webForm
how to increase timeout time, my session is falling around 5 min, it is not in the connection string. Asp.Net Authentication Aspnet Identity <sessionState mode="InProc" timeout="20"/>…
-
0
votes1
answer216
viewsSpecial characters Webservice C# SQL X Base Firebird
I have an integration made by Web-service (asmx) , C# e SQL Server. This Web-Service is consumed by a third-party software that uses Delphi and Firebird. The problem is that when integrating a…
-
0
votes2
answers4220
viewsAdjust Form layout according to monitor resolution
I made a form in fullscreen, where the monitor I use is 23'' inches. But where the functionality will be deployed, they use 19". When I executed, the Form did not get the size of the smaller…
-
0
votes1
answer92
viewsListbox is not adding Subitems
I used the following code: ListViewItem item1 = new ListViewItem("Coluna1"); item1.SubItems.Add("SubItem1a"); item1.SubItems.Add("SubItem1b"); item1.SubItems.Add("SubItem1c"); ListViewItem item2 =…
-
0
votes1
answer20
viewsXtragridview - Where with variable
Everybody good night, how are you? I’m creating a user registration screen, where every user has an ID, on this screen, I have an xtragridview, which carries some address information. However, in…
-
0
votes0
answers65
viewsCall Alert When I Get a Session Value
Hello! I am trying to call a javascript Alert as soon as I get some value in a Session. I am using C# with ASP.NET Follow my code with the attempt to show Alert, but to no avail:…
-
0
votes0
answers44
viewsHow best to represent a FK in the field
I have for example two entities in my BD. Type_user and User. User receives a Typo_user FK from the Idtipousuario field. In my Domain(C#) I would have: TipoUsuario public int IDTipoUsuario { get;…
-
0
votes1
answer77
viewsSet variable in form designer
How can I set a variable in a form designer? Today I set the variable for my parameter, but when I see the form it gives this warning (even with the warning, it normally runs): The variable…
-
0
votes2
answers170
viewsHow to center panel within groupbox?
How can I center panel1 within groupbox ? Follows code: private void Form1_Load(object sender, EventArgs e) { // aqui defino novo size do panel1 panel1.Size = new Size(591, 423); } The problem is…
-
0
votes1
answer34
viewsWeb components for searching database data
I’m doing a small system of registering product items. As I came from Delphi I was looking for a way to load the products by code or by name in a Dropdownlist. I was searching and saw a system that…
-
0
votes2
answers180
viewsXamarin Webview Keyboard above the site
I have a project in Xamarin Forms, with a webview inside it. When clicking on any input the keyboard appears, but overrides the html page input. someone knows how to solve?
-
0
votes2
answers125
viewsFind Values between two prefixes and swap one for the other
I’m developing an application where you have to find a definite value and literally walk 19 houses. 130000007363645C7363645F 6178747265653030311300000073 6363645F6178747265653030315F Search for…
c#asked 8 years, 4 months ago Emanuel Lucas 41 -
0
votes1
answer45
viewsRestarting progressibar count c#
I have in my code a progressionBar, which is filled in 60 seconds, how do I so that when I arrive in 60 seconds he start counting again. private void timer_progress_Tick(object sender, EventArgs e)…
c#asked 6 years, 12 months ago Junior Guerreiro 617 -
0
votes1
answer967
viewsOpen or Form1 or form2 on winform program startup
I have a program in vb6 and has two buttons - A scanner and another for scanning images. I created a program in c# winform where the project has 2 Forms - a Form1 for the scanner and another form2…
-
0
votes3
answers934
viewsI can’t post with Webapi
I’m studying Webapi and using Postman to test it. Doing some tests I realized that nothing comes when I send json using Postman to Webapi. I researched a lot about POST using Webap, but I don’t know…
-
0
votes1
answer334
viewsMVC - Keep Partialview loaded when Modelstate is not valid
I have a simple registration screen that, when selected new record, is opened a modal (which is a partialview in the project) for the user to inform the fields for registration. The view call is…
-
0
votes0
answers263
viewsDoubt in html. Viewbag-powered dropdownlist
I’m having the following problem: I need to send instead of the Id of ViewBag, the Municipio, which is contained in ViewBag.Cidades. How Do I Switch from Id to Municipio when I click Search to send…
-
0
votes0
answers106
viewsEntity Framework error mapping classes from existing database
I have an SQL Server database and had the mapping classes automatically generated from the existing database. However, when I run the application, it gives the following error: (404,10) : error…
-
0
votes1
answer218
viewsConnection String not found WPF Entity Framework
I am in a WPF project using some MVVM practices, I am using Entity Framework database first and the Connection string is already in the app.config, I have already followed all the procedures I have…
-
0
votes2
answers657
viewsSave Image in VARBINARY with C# ASP.NET
How do I get a received image in a Form HTML and write to the bank in VARBINARY with C#? I’m using C# ASP.NET MVC5 CORE.
-
0
votes1
answer141
viewsError when selecting part of a string in the select of an entity using Entity Framework and Linq
I need to assemble a Drop-down with part of the name of a project, which is very large in the database, goes up to 250 characters. For this I made a selector like this: var lista =…
-
0
votes0
answers39
viewsWhat is the key word "virtual" in C#?
In C# is seen some class using the keyword virtual in some methods. Example: class Person { public virtual string GetName() { // faz alguma coisa aí } } I’d like to know what this one’s for virtual.…
c#asked 6 years, 12 months ago Wallace Maxters 102,340