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
answer116
viewsSending new value to all users via signIR
I need to make all users receive the updated values on their screens as soon as the function AutonavHub.client.printPackageInfoFloat(objeto) is called within $scope.adicionar = function (objeto)…
-
3
votes1
answer5784
viewsERROR: "only one use of each socket address is normally allowed"
Before you say that "the door is already being used, try another one", I have received this answer several times, and changing the door simply does not work. Well, I’m developing a game that uses…
-
3
votes1
answer641
viewsBematech MP-4200 TH waitingPrinting
Good afternoon I am developing an application that needs to make sure that the document was printed on the non tax thermal printer Bematech MP-4200 TH, as the printer has buffer even if there is no…
-
3
votes1
answer40
viewsSize of the form other than programmed
I created a form, with size 300;300, in it a button with the following code: MessageBox.Show(this.Size.ToString()); The Forms are getting too big for my screen, so that running can be readable. Why…
-
3
votes1
answer52
viewsXAML with parameter - Backgroundworker
I’m doing a small XAML application that asks for 2 dates. Dates are passed as a parameter to some methods invoked by the Event click button. The problem is that during the execution of the methods…
-
3
votes1
answer322
viewsProblem saving checkbox text value to my database
You wanted to save the days of the week selected by the user, storing the contents of the label as string. What comes to the controller when I select all checkboxes Domingo false Segunda-Feira false…
-
3
votes1
answer131
viewsHow to make a lambda pivot in a C#list
I’m having a hard time making a pivot command on a list that’s coming from the bank. Above the select that is coming with the data.. The data field q I would like to put the pivot command. Follow my…
-
3
votes1
answer71
viewsHow to resolve c#debugging error?
I’m running the release of my C# program on another machine, and it is generating debug enabling error. You can help me with this?…
-
3
votes1
answer53
viewsDataset does not recognize LIKE and search parameters
Good night.I have a table in the Mysql database and am using a Dataset to handle it in my Windows Form project. The problem is that when I try to use a query with LIKE, it does not recognize the…
-
3
votes1
answer865
viewsRecovering Findcontrol from Parent Peater in Child Remaster event
I’m having a hard time getting a field of my parent Peater at the click of my linkbutton inside another Peater (son). My Parent contains the report code and other information and my Parent contains…
-
3
votes2
answers649
viewsSort a Multidimensional array by column c#
I have a multidimensional array: string[,] classificacao = new string[20, 2]; and which has the following inputs: classificação[0,0]="Hamilton"; //ISTO É O NOME DO JOGADOR classificação[0,1]="20";…
c#asked 7 years, 4 months ago Tiago Pereira 43 -
3
votes2
answers1320
viewsHow to hide a password in C#
I want to hide my password. What I want to happen is that while I type " * " is shown instead of characters, the problem is that it only happens when I click on the "Log in". Yes, I know this…
-
3
votes1
answer77
viewsEntity Framework - Data Access Tips
I am working on a project using EF6 with C#, in one of my classes I have to save a file, example below: public partial class Arquivo { [Key] public int ArquivoID { get; set; } public string Nome {…
-
3
votes1
answer1173
viewsAsp.net MVC Models Heritage
I am trying to implement a person register where I have the inheritances for legal and physical person, but my saving method is not getting the type of person properly. follows example code…
-
3
votes3
answers1491
viewsHow to replace the number of letters of a word with a character?
I’m doing a hangman’s game, let’s suppose I type the name "john" into a box of text, then I press a button and I want the "text 2" box to have "_ _ _", so I want the same number of underscore that…
-
3
votes2
answers2292
viewsOperations with time quantities and conversion between time units
Is there a library specializing in the handling of quantities and units of time? Allowing the conversion of/into milliseconds, seconds, minutes and time sum and subtraction operations. Native in c#…
c#asked 7 years, 4 months ago Jhonatan Jorge de Lima 1,012 -
3
votes3
answers1314
viewsFormat Field C#
I know the 'N' and 'C' formatting of C#, but they do not suit me. I get 1000 database and would like you to format to 1.000. What I put in the .ToString("???")…
-
3
votes0
answers43
viewsFormat Date C#
Format Date I receive 2017-06-13 from the database, using the code: Dia = sqlDataReader["DESCRICAO"].ToString(), I would like to show 13/06/2017, how can I do this formatting?…
-
3
votes2
answers305
viewsBest way to recover data for a Datagridview?
What is the best way to recover data from a direct table to a Datagridview ? I have several doubts, because, many people do not recommend using Unitofwork which makes it much easier and leaves the…
-
3
votes2
answers616
viewsDynamic Connection EF C# Windows Forms Mysql
I have the following problem: EF creates a connectionString in the app.config and uses this connection always, but if you need to change the database server I will have to change the app.config. I…
-
3
votes3
answers944
viewsReturn the Id of table 1 and insert in table 2 in the same code
Talk guys, next, to with 2 tables (Group1 and Group2), there I have a form that has several fields that will be inserted at the same time in these 2 tables. But I need to insert in the table Group2…
-
3
votes2
answers502
viewsObject Reference not set to an instance of an Object
I know the question is a little subjective, but maybe someone’s been through it and can help me. I have an application developed in C#/Windows Forms/ADO.NET with Firebird database. The error "Object…
-
3
votes1
answer737
viewsHow to create an application from scratch in ASP.NET MVC?
I’m studying about the Asp.Net MVC and here I already got a good base of how to start from scratch with Empty, as I haven’t found a good tutorial on how to start. My problem is this: I have this…
-
3
votes1
answer176
viewsProgressbar with WPF and Ionic.zip
I use the Ionic.zip dll and on it unzipo and rezipo some files and folders. My manager asked me to put a ProgressBar and I’m doubtful how to do it using WPF. It’s very fast and I don’t know if it’s…
-
3
votes1
answer149
viewsAdd() method does not add Timespan to Datetime
I created a Datetime with some values started in the constructor, but when I add a Timespan with some values, it does not add together with the date. I am using the Datetime method to add a…
-
3
votes2
answers8240
viewsDouble quote character removal "
I have a code that reads a CSV and saves the information in the database, but I ended up getting a CSV "different" than what I’m used to reading. This CSV come with double quotes in the information.…
-
3
votes1
answer2138
viewsFunc<T, bool> and Expression<Func<T, bool>>
Well I’d like to know first what the difference is between Func<T, bool> for Expression<Func<T, bool>> And how do I convert from Func<T, bool> for Expression<Func<T,…
c#asked 8 years, 6 months ago Diego Zanardo 3,301 -
3
votes1
answer484
viewsTo add runtime property to an already created class C#
I need to add properties in the Griddatasourcebase class at runtime, someone can help me how to do this? public class GridDataSourceBase : IGridDataSource { public long Handle { get; set; } }…
c#asked 7 years, 2 months ago Nicola Bogar 1,149 -
3
votes0
answers161
viewsXML Reading Error from NFE Electronic Invoice
People I used windows XSD application to generate classes for NFE, it worked 100%, now I need to use these classes to fill with data of the tax notes that will be imported, I’m doing this: TNFe nfe…
-
3
votes0
answers39
viewsWhat are structures for. NET?
What are structures for (struct) no . NET? What differs a class from a structure? In which cases would it be more feasible to use a structure than a class?
-
3
votes3
answers318
viewsDifference between properties syntax in C#
For what I researched, if I do: public int numero { get; set; } is the same thing as: private int numero; public int Numero { get{ return numero; } set{ numero = value; } } But in the first chunk of…
-
3
votes1
answer86
viewsString truncate when performing append
The code below serializes a JSON list and gives a append the variable result. However, from a certain amount of records (350), the text contained in result has a modified part for "..." . I…
-
3
votes1
answer416
viewsHow to format Datetime in C#?
I know two ways to format a date in C#: data.ToShortDateString that gives me a return like this: 21/07/2017 data.ToLongDateString that gives me a return like this: Friday, July 21, 2017 I want a…
c#asked 7 years, 2 months ago Italo Rodrigo 4,344 -
3
votes2
answers62
viewsDoubt in the method declaration
Observe the following code: class Program { int marks; static int maxmarx = 50; void CalcularPorcentagem() { int porcento = (this.marks * 100) / Program.maxmarx; Console.WriteLine(porcento); } After…
c#asked 7 years, 2 months ago Mateus Binatti 401 -
3
votes2
answers310
viewsProblem with Valueobject in the Entity framework
I’m having a hard time with a mapping and I’d like to know if it’s possible to do that: I have a Contact class with two fields that are Valueobject type "Phone", the fields are Phone and Mobile.…
-
3
votes1
answer257
viewsWhat is GUID for Visual Studio projects
I have a "base" project in C# MVC (login, access control and related), to replicate in other projects, which consists of copying the fonts and sometimes renaming the project. Do I have to change the…
-
3
votes1
answer99
viewsHow to create an asynchronous method that is cancellable?
How to create an asynchronous method that is cancellable? In this context, the DoFoo() does things that cannot simply be stopped, like reading and writing files, and when canceling, I have to wait…
-
3
votes1
answer105
viewsHow does the use of other numerical bases in C#work?
When I was learning the basics of variables in C#, I learned that the whole numerical statements (Int32) used the numerical base 10, which is what we use most commonly in our day to day life. A…
-
3
votes1
answer158
viewsStore List<Menu> In Memory or Cookie
good afternoon. I have an application that has a whole level of permissions management of access to pages and a number of other settings. Whenever a user authenticates, I assemble a list of all the…
-
3
votes1
answer143
viewsCan I create a Win32 app in C#?
I am aware that C# is . NET Framework’s right-hand man, and that the default language for programming Win32 applications is C++. But, I can program an application in C#, independent of any . NET…
-
3
votes1
answer361
viewsHow to programmatically format Excel Numbers in C#
I’m putting together a C#Orders report, I’m using the library Microsoft.Interop.Excel and I face a problem: It is necessary to include in this report the Request number and when presented in Excel,…
-
3
votes1
answer1817
viewsMalformed Reference Element: Digital Signature
I ended up having the same problem about a post already made here, but they see a question next to what was posted in the article. Which windows update would be to remove among those cited in this…
-
3
votes2
answers1031
viewsNull object on Deserializar Json
I request an API, which returns data in the form of JSON. Example: { "id": 8452, "creator_user_id": { "id": 46342, "name": "ADM. Suporte Comercial", "email": "*******@gmail.com", "has_pic": true,…
-
3
votes1
answer4847
viewsHow do I put the value of a variable inside a textbox?
Guys I’m having a boring problem. I wanted to put the text I took out of a textbox and put in another that this defined as readonly. I wanted it to work as a label. I tried textchange gave error.…
-
3
votes0
answers161
viewsGenerating Report with Reportviewer
How is it possible to generate a report of an object and its dependencies in Report Viewer with C#? I have a Car class, where each Car has its Models. I can display a report with the Cars and Models…
-
3
votes1
answer187
viewsThere is no variable c#
This is C#’s mistake, or I’m doing something wrong because in my logic it should work perfectly. public partial class Form1 : Form { Banco Bbanco; Bbanco = new Banco(); }…
c#asked 7 years, 1 month ago rock.ownar 355 -
3
votes2
answers543
viewsHow to find out if I need to rotate the image
I am implementing some features to perform OCR in images and so far everything is going very well. The problem is; the OCR works well if the image is in the correct rotation, if it is upside down or…
-
3
votes1
answer180
viewsVariable with unassigned value within a "for" loop
int i; string cpf; cpf = "11111111111"; DbConnection cnx = ADO_Utils.GetConnection(); DbCommand cmd = ADO_Utils.GetComando(cnx); cmd.CommandType = CommandType.Text; for (i = 1; i <…
-
3
votes1
answer96
viewsLINQ to SQL Inheritancemappingattribute Code property
What is the purpose of the property Code of the attribute InheritanceMappingAttribute? The documentation describes this way: This Property Holds a value that appears in the database table in the…
-
3
votes2
answers837
viewsOperator error cannot be applied to the method group
I’m trying to print a date subtraction using C# with Webforms, but I don’t know how to correctly insert attributes in methods or how to print the method. I’m converting the subtraction of dates into…