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
-
3
votes1
answer70
viewsHow to handle C# data from a table that is bit-like in sql server?
In visual Studio will look like this: alerta.DataHoraCadastro = dr.Get(12); How do I do that?
-
3
votes1
answer658
viewsCan C++ and C# be used using C programming?
If I build a code for a sotfware and want to use the C, C++ and C# languages could I? Even if I use a compiler that reads all three?
-
3
votes2
answers125
viewsImplementing relationship in C#
I have the following classes: The code is like this: public class Mae { public string Nome {get; set;} public List<Filho> Filhos {get; set;} } public class Filho { public string Nome {get;…
-
3
votes1
answer379
viewsHow to update the value of one cell based on another in WPF Grid View
I have the following Grid, I would like to know how I can do so that when I leave the Gain or Spend field it updates the Total? If there’s any other way I’m happy to meet. Total = (Gain - Expense)…
-
3
votes1
answer246
viewsCreate second column in Datatable
I have a DataTable where with the code: DT.Column.Add("1ª", gettype(int32)) For I = 1 To 30 DT.Rows.Add(I) Next(I) This For lists column 1 from 1 to 30. 'DT is declared with a new DataTable, in this…
-
3
votes1
answer2266
views -
3
votes1
answer2756
viewsWhat is an Associative Table?
Well, I see some examples of code using associative tables. But I’m not sure what this term means, its applicability, the concept etc... What is an associative table?
-
3
votes1
answer151
viewsMVC Helper with List Energy
I am creating a Helper in my Asp.Net MVC 5 project, and would like to receive as a parameter a generic list, but the following code snippet does not work: @helper MeuHelper(string param1, int…
-
3
votes2
answers1336
viewsRemove Time in Datetime field
Dear friends, I need to present only the date in a Textboxfor field. I use this HTML Control because I use a Javascript mask that formats the field value at the time of the date input.…
-
3
votes1
answer72
viewsGet character index based on Width
I have the following method to calculate the width of a text: public float GetWidthOfString(string str, Font font, int bitmapWidth, int bitmapHeight) { Bitmap objBitmap = default(Bitmap); Graphics…
-
3
votes1
answer800
viewsHow to check if the LINQ expression does not come null
I have this expression LINQ: MaterialImage mainImage = images.First(i => i.IsMainImage == true); My problem is that images. First(i => i.Ismainimage == true) can return null if you have no…
-
3
votes1
answer234
viewsDynamic linq with C#
Inside the new in Linq. I need to create the dynamic properties based on a data table how can I do this? var query = (from indicador in tableIndicado.AsEnumerable() group indicador by…
-
3
votes1
answer275
viewsHow to serialize a datetime displaying in the dd-MM-yyyy hh:mm:ss format
How do I send to View() of my Controller in Json format, the default formatted date dd-MM-yyyy hh:mm:ss? In the transport of data between View and Controller I am using AJAX. public ActionResult…
-
3
votes2
answers419
viewsError creating data with foreign key
Hello, I am not able to insert data in a table that has foreign key, follow my model: 2 tables, Departamento and Funcionario, the official has the foreign key IdDepartamento. And I ran the…
-
3
votes1
answer85
viewsClosing requests
I currently make several HTTP/HTTPS requests to different websites using the classes HttpWebRequest and HttpWebResponse using framework .NET 4.0*. We are facing a problem when there comes a time we…
-
3
votes1
answer1199
viewsHow to get filename within folders in WEB API server
I have a directory Archive/Uploads And I would like to list all the files, within this directory I have N folders. what I’ve got so far is here. string path =…
-
3
votes1
answer466
viewsReload Datagridview in C#
I am creating an event of a button in which it creates a Product object and adds in a list of Products and using this list to fill the Datasource of a dataGridView, but Datagridview keeps appearing…
-
3
votes1
answer2479
viewsOpen Source E-commerce in ASP.NET
I know that in PHP there is a lot of e-commerce framework in the market today, but in ASP.NET, which framework exists today? What advantages and disadvantages of each? Is it worth using or building…
-
3
votes1
answer551
viewsLoad txt file through a list c#
I make a query in the bank and put it in a list, then see each item of the list through the foreach to view other tables according to the Id of each row traveled. If found, I would like to upload a…
-
3
votes2
answers126
viewsEdit MVC with Foreign Key
I need to upgrade my editLivros, Next I’ll explain my project. Autores ------- IdAutor Nome Livros -------- IdLivro Nome IdAutor I am registering the Authors and Books correctly, when I am…
-
3
votes2
answers411
viewsTextbox_changed is accumulating the sum value c#
I’m using the event textBox_Changed and when I type a value into the field, another textBox should receive this value, but this other textBox called ValorTotalVenda is accumulating this amount.…
-
3
votes2
answers253
viewsHow to work with a Datetime instance without the time information
My tests had been passing successfully, when "by magic" one of them started to fail: var data1 = DateTime.Now.AddDays(1); ...processos ...processos var data1 = DateTime.Now.AddDays(1);…
-
3
votes2
answers423
viewsHow to manipulate instance properties of a class that is in a List<T>?
I have a class called Pessoa, this class has two properties Nome and Idade, I am using a List<T> to manipulate data, I know I can manipulate data like string or int creating a…
-
3
votes0
answers55
viewsAccessviolationexception When I type ALT or TAB C# WINDOWS FORM
Guys, I have a form where the Form (Plano_aula) calls the form (Call) , in this Form Call has a list of students and a Panel that stays with the Visible = false, in this same screen I call a class…
-
3
votes1
answer68
viewsUpload 2 files via ashx
I have the screen below: I need the user to select a song and a cover, but I’m not finding a way to send both files at once and still validate if the Music and Cover was selected. Until then I…
-
3
votes3
answers1778
viewsScaffolding error during View generation
I am creating a new project using EF Power Tools and I have the following error: Error There was an error running the Selected code Generator: 'A Configuration for type 'TST2.Models.Course' has…
-
3
votes1
answer350
viewsEntity Framework: Data Model with column with the largest number of characters possible
I’m creating the tables with the Entity Framework, and I’m using the Data Annotation to determine the amount of characters, I wanted to know which larger size was supported for typing text and…
-
3
votes1
answer155
viewsCreate dashboard with center at user click point
I need to create a Panel in a Form Getting kind of like this: When you click the mouse on Form create the Panel taking the location of the click and create the Panel centralized. I did so: Panel…
-
3
votes1
answer836
viewsReceive by Parameter and Manipulate a Generic Object LIST
I need to receive an Object List by parameter Generic and manipulate, although researching did not understand right how to do. Example: public class Funcionario { public long Id {get; set;} public…
-
3
votes1
answer128
viewsValidate by js with for each
On this screen I need to do a validation so that in each record, when the record has permission, in case it is marked bring me the record marked with it every time I edit (mark or deselect the…
-
3
votes1
answer1042
viewsWhat is ASP.NET’s Httphandler and Httpmodule?
What is the Httphandler and Httpmodule of ASP.NET? How they work? And how to use?
-
3
votes3
answers1157
viewsRegex check IP
I am implementing a regex to accept IP address, for this I am using a Mask in the textEdit component of Devexpress, however when I leave the field blank or with only one filled part locks all other…
-
3
votes1
answer1051
viewsCreate fields dynamically and set in model
I am developing a register, where I have my fields according to my model: public class Autor { [Key] public int IdAutor { get; set; } public string Nome { get; set; } public DateTime DataNascimento…
-
3
votes2
answers914
viewsTime difference Timespan in 24hrs format
I am asking this question because I have not located any topic with my problem, which is very similar to others. I have 2 fields TimeSpan? one of which relates to check-in time and the other to…
-
3
votes2
answers1744
viewsHow to change the name property in @Html.Editorfor
I have the following class: public class ModelHome { [Required] [Display(Name = "Nome")] public string Nome { get; set; } [Required] [Display(Name = "Email")] public string Email { get; set; }…
-
3
votes1
answer157
viewsLinq groups and fetch max id
Is there any way to optimize the code below so that you search the forms that have the maximum version according to the IdCentroCusto? In the code below I’m doing the grouping and catching the…
-
3
votes2
answers58
viewsAre there any components that replace Windows Forms Spinedit in WPF?
I prefer open source components, or if possible a form of adaptation, because I did not find any Spinedit or similar in WPF.
-
3
votes1
answer122
viewsError formatting string with number
I want to format a string so it has six digits filled with zeros on the left. I’m using the following code: string.Format("{0:000000}", linha.Quant.ToString()); He’s returning the next: 67 = 00067…
-
3
votes2
answers955
viewsPass variable to another form, dynamically generated C#
I have a question regarding passing the value of a button to another form. I have the following code private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) {…
-
3
votes1
answer322
viewsHow to search for tags using Regular Expression?
I would like to create a regular expression that searches for tags: <b>, <p>, <i> How would you do that in regular expression?
-
3
votes1
answer66
viewsJsonreaderexception when performing Jobject.Parse
When I execute JObject.Parse starts an Exception content: Error Reading Jobject from Jsonreader. Current Jsonreader item is not an Object: Startarray. Path '', line 1, position 1. The Json I’m…
c#asked 8 years, 10 months ago FRNathan13 2,183 -
3
votes1
answer342
viewsHow to make the keydown function work with the program in the background?
Code: if (e.KeyCode == Keys.F7) { A1 = !A1; } How to make this code work without the program being in the foreground?
-
3
votes2
answers1914
views -
3
votes1
answer363
viewsInsert current date in a field
I’m using dataAdapters do . Net to create a project as a BD learning base with C#. I chose an easier path that would be to work most of the time in design mode through the Datasets. The battle I…
-
3
votes2
answers757
viewsCreate a Stream object from a string
I need to create an object of the type System.IO.Stream from the content of a string. This one of mine string is in an archive Resource.resx. I get her back that way: string xml =…
-
3
votes1
answer450
viewsHow to mark/warn a method is obsolete
I have noticed several times some warnings in Visual Studio about obsolete methods of some components/libraries: Like leaving the method obsolete below: /// <summary> /// /// </summary>…
c#asked 7 years, 7 months ago user26552 -
3
votes1
answer462
viewsAccess MDF database from executable folder
I am having an annoying problem solving as I want my application to access the database file from the folder where the executable is, because on every computer installed that folder may be on a…
c#asked 8 years, 9 months ago Ezequiel Barbosa 1,361 -
3
votes1
answer931
viewsTake the highest value within the Line select
Is there any way that inside the select do linq I can take the highest value of a field of the type decimal?, according to the code below? MaxValor = Math.Max(CF.Janeiro, CF.Fevereiro, CF.Marco,…
-
3
votes1
answer178
viewsJavascript set value of one field in others
I have the following code below <script type="text/javascript"> function getValue() { var x = document.getElementById("NuJaneiro"); document.getElementById("NuFevereiro").value = x.value; }…
-
3
votes1
answer447
viewsHow to keep MVC application running on IIS express (in Visual Studio) after debugging?
I’m doing a project on ASP.Net MVC. On the company machine I run the project once (F5), stop the debug and continue accessing the application pages normally. On my personal machine if I stop the…