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
votes3
answers1099
viewsHow to keep the default Textbox look changing the value of the Readonly property?
If the value of the property ReadOnly of a TextBox for false means that I can change the content. However, when the value is true content can no longer be changed, however, when we change the value…
-
1
votes0
answers93
viewsKendo UI - Multiselect with remote data source
I’ve been racking my brain with multiselect of Kendo UI. Every time I return the list with my information action, the plugin fails to understand the information and returns me the following error:…
-
1
votes1
answer855
viewsC# Error Nullreferenceexception in Tolist() method
I am working on a C# MVC WEB project with Entityframework. I was able to configure it together with the database and also installed Ninject. The first controller I’m working on is Users. I want to…
-
1
votes2
answers1294
viewsshow selected value in listview c#
Good morning. I have a listview with a list view. I wanted you to save the selected value when clicking on a certain line. How can I do?
c#asked 7 years, 4 months ago Ana Carvalho 389 -
1
votes2
answers190
viewsRU with TPT inheritance and audit fields
Hello. I’ve looked for answers in TPT and Entity tags but I can’t find anything like it. My problem is trying to use an inheritance model (TPT) where tables have fields with the same name (example:…
-
1
votes2
answers376
viewsSubconsulta in Lambda
I would like to do a sub-query today on SQL: SELECT intid as IDCliente, (SELECT TOP (1) int_EP FROM tbl_estagioprocesso WHERE (int_IDC = tbl_Admin.intid) ORDER BY int_ID DESC) AS int_EP FROM…
-
1
votes1
answer331
viewsSubtract from a number the values to your right in a list
I have a situation that is as follows: given an array with for example 5 positions [5, 10, 8, 2, 7] I need an algorithm that allows me to do the following: Take the 5 and subtract by the numbers…
-
1
votes0
answers224
viewsLayered communication
I have 3 layers , BLL, DAL and the Project. In the DAL layer is the ENTITY (automatically creates the Gets and Sets) and I want to use the Gets and Sets Because when it arrives in the project layer…
-
1
votes1
answer32
viewsWhat’s this C#resource called
I always saw it in the c# var button = new Button(this.ApplicationContext); button.Text = "New button; Only now I saw that the way below also the, accessing the properties directly with {, what this…
-
1
votes1
answer515
viewsMiddleware with ASP.NET MVC and . NET 4.5
It is possible to add some middleware the routes that will, for example, allow or redirect a user to access the admin panel, which if not authenticated will be redirected to the login area? as in…
-
1
votes1
answer88
viewsRun a program with internal arguments
How is it possible to create a Process, enter it without allowing any user to view the arguments? Ex: Executable: Mygame.exe Arguments: -userid 0 -userpwd 0 but without allowing the task manager or…
-
1
votes1
answer666
viewsAlter color of the Datagrid cell
I have a Datagrid in C# WPF, and I need to change the color of some cells according to one condition. For example I have the Stock column and if the Stock is less than a specific value I put its…
-
1
votes1
answer44
viewsRemove element in Interop
I am developing a tool that will generate a file in format . DOC, the form fields will be filled in anyway but would like to put a formatting that removes any symbol from the text. Ex: "• ", "¹²³£"…
-
1
votes1
answer749
viewsThe various part identifier "System.Data.Datarowview" cannot be associated
Try { if (cmbFavorecido.SelectedValue != null ) { txtID.Text = cmbFavorecido.SelectedValue.ToString(); cn = conexao.ConectarSqlServer(); cn.Open(); SqlCommand cmd = new SqlCommand("select…
-
1
votes1
answer631
viewsError converting HTML to PDF using Xmlworkerhelper
While exporting the HTML file to PDF using iTextSharp and Xmlworker error occurs in some situations saying that certain tag is not closed and searching found this post How to Convert HTML to Valid…
-
1
votes4
answers2106
viewsValue treatment null c#
I have a method that generates me an execption, how to treat this?: I thank you public string CarregaProdutosDermaClube(string codigoproduto) { //consulta os dados var tbuscar = new…
-
1
votes1
answer601
viewsCreating Mysql connection with Fluentnhibernate?
I am trying to create a connection with Mysql using Nhibernate and Fluentnhibernate. I added by nuget the MySql.Data but when I try to make the connection MySQLConfiguration not found in context.…
-
1
votes1
answer128
viewsPerform a select and return the emails in a list
My question is this: I am studying C# and I’m working on a student registration project (study only). I made a form to send an email in case the student misses school, only I did not implement the…
-
1
votes1
answer80
viewsProject default is not found
I went to install a Nuget package and gave error Project default is not found. Well, I went to ComboBox Default Project to add the project I want to install the package and Combo does not list…
-
1
votes1
answer818
viewsCustomize Tabcontrol C#
I need to customize a Tabcontrol, like, change the colors of the tabs when selected, leave the Tabcontrol without border (flat type), etc. I tried using the Tabcontrol component of Windows Forms and…
-
1
votes2
answers534
viewsLINQ update of all listed items (changing the status of all listed items)
I have a Linq that presents data listed according to the required filters (date and unit) by the user and another filter to validate a code with another table (which is not the case). I wonder how I…
-
1
votes1
answer4453
viewsCopy string from a position
I have it: private List<string> _listaCommiter() { string s = string.Empty; string _start = ConfigurationSettings.AppSettings["dir_inicio"]; List<string> lista = new…
-
1
votes3
answers1171
viewsBreak a txt file into multiple items in a string list
I have a txt file with 2000 names. When I load into a list, Count is 1 and not 2000. Of course, because as it comes to a text file is only 1. It turns out, that the file is organized with \n\r…
-
1
votes2
answers49
viewsFilename coming from a txt and files. Is there a difference in comparison?
I created a list with 13 filenames, which I extracted using Getfilename(). Another list I broke a txt file and loaded these names into another list. So I have this: ListaNomeArquivo ListaNomeTxt I…
-
1
votes1
answer61
viewsDatasource C# - Problem reading multiple data
I have a code, where he opens the browser and works within a certain page. On this page, I have some fields, where I look for information from a spreadsheet in excel (xlsx). On this same page, there…
-
1
votes0
answers169
viewsHow to pass C# pro PHP encryption
Guys I have to pass numerical information from a C# application to a php function in order to have a minimum security.I have to pass the points of my application (game) to the bank and want, to…
-
1
votes1
answer706
viewsForm data validation in ASP.NET MVC
Is there a faster and simpler way to validate a form’s data in ASP.NET? so that I don’t have to be doing as many treatments as in the example below: [HttpPost] public ActionResult Attempt(string…
-
1
votes0
answers261
viewsChromedriver.exe error using Coypu for Selenium
I’m making an app, to test this framework unit test. However, it indicates an error that cannot find the path where Chromedriver.exe is, the same is found in the folder I indicated. Here follows my…
-
1
votes1
answer966
viewsInsert via Entityframework error "IDENTITY_INSERT is set to OFF"
I have several models and for some reason one of them presents the following error: Cannot insert explicit value for identity column in table 'tbl_boleto' when IDENTITY_INSERT is set to OFF. I…
-
1
votes1
answer178
viewsknow how much a i/o disk consuming process
all right? I can already monitor CPU, memory Ram, Disk... but, I haven’t figured out how much a process is spending disk. Is there any way in c# for that?
-
1
votes1
answer348
viewsHow do I edit an element of this array?
I have an array this way: List<dynamic> business_list = new List<dynamic>(); business_list.Add(new { business_Name = reader.GetString("name"), business_OwnerID =…
-
1
votes1
answer648
viewsError trying to create Excel table with Closedxml
I’m trying to create an application that generates an Excel spreadsheet through Visual Studio 2015 using Closedxml as a reference. As I found some examples on the web, I added it to the code (using…
-
1
votes2
answers120
viewsInsert text into images
I have a Switch that according to the given status it plays an image, but I would also like to play the numbering of that status in the image (that text that usually when we touch the image it…
-
1
votes2
answers130
viewsRemoving part of the link on ASP.NET MVC routes
My Routeconfig is configured this way: routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "{empresa}/{controller}/{action}/{id}", defaults: new { empresa = "",…
-
1
votes1
answer44
viewsHow do I add a value to my database?
I need that if the value is null, it adds the variable getid() to the database. string comando = "SELECT COUNT(*) FROM usuarios WHERE username=@Usuario AND senha=@Senha AND tipo=1"; var connection =…
-
1
votes1
answer192
viewsPass Switch to Controller
I have been looking for a solution for several days but I haven’t found anything useful to me. The problem is this, I have a Conttroller receiving data from View, so far so good, but when I capture…
-
1
votes1
answer98
viewsWeb Helper Chart does not appear in the server application
Action that mounts the Chart: public ActionResult GraficoPedidos() { int [] arrayP = new int[12]; int aux = 0; for(int i = 1;i <= 12;i++) { int numero = Convert.ToInt32(context.Pedidos.Count(p…
-
1
votes2
answers2012
viewsSystem.Outofmemoryexception error
I don’t know how to solve this problem: As noted by Marcos Marques this is about the size for each record in total of 4 thousand records. Where can I improve the code: public ActionResult…
-
1
votes1
answer242
viewsupdate tab of tabcontrol
I’m creating a program in Windows Forms and on my page I put a Tab Control with a tab to register and insert the data in Mysql and the other to see the data registered in a Combobox. Only when I…
-
1
votes2
answers1579
viewsNOT IN in Inline using a sub-query
I am using as a basis the answer in: https://stackoverflow.com/questions/432954/not-in-clause-in-linq-to-entities I need to make a query where do not contain (NOT IN) the Ids coming from another…
-
1
votes0
answers33
viewsStreamwriter C#
I have the following code: using (var stream = new System.IO.StreamWriter(System.IO.File.Open("c:\\file.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite))) { infoSerializer.Serialize(stream,…
-
1
votes1
answer170
viewsCustomize Identityuserclaim
I’m trying to customize the Identity Claims table, through the Identityuserclaim class. I am using a mapping, through the Entitytypeconfiguration class, but I get the error: A Configuration for type…
-
1
votes1
answer272
viewsYou doubt with Fluentnhibernate mapping?
I am trying to create a scheme to define permissions on my system and these permissions are given to the user profile, where one can choose what each profile is authorized to do on each module. For…
-
1
votes0
answers298
viewsEnter in Textbox by calling button event
When I hit enter in a textbox, it is calling the "Filtrogridview" and then it calls the button event. <div class="TextRight"> <asp:TextBox ID="txtBuscaNome" runat="server"…
-
1
votes1
answer353
viewsHow to access properties with "." in the name on a Dynamic object
I have the following JSON object: { "odata.metadata":"httpXXXXX", "odata.count":1443, "value":[ { "codigo" : 1 , "nome" : "ABS"} ] } and create an object like this: dynamic categorias =…
-
1
votes2
answers508
viewsHow do I do INNER JOIN in this case?
I’m a beginner in Postgresql and I need to make a INNER JOIN to relate data from two tables. It took me a long time to understand this FOREIGN KEY, but I made the right reference in the database.…
-
1
votes1
answer70
viewsHow to put only the class name on the combobox?
When adding an object to a combobox and checking it, the full name of the class appears according to Microsoft conventions: NomeDaEmpresa.NomeDoProjeto.ModuloDoSistema. How do I make only the class…
-
1
votes1
answer84
viewsReceiving database search with SQL Reader
Facebook is a class where I store user information, but I don’t know how I use the ExecuteReader to get the information. Can anyone help me with this? (I’m new to the language c#) public Usuario…
-
1
votes2
answers40
viewsPull the information last information you will use for comparison
I have a question in SQL, what I want is the code to pull the last information of this column and compare with a label of my site, but I do not know if the Last Insert Id is better or correct to…
-
1
votes2
answers616
viewsASP NET MVC - Download html table
I have a view that has a whole table structure, by typing the view path in the navigation bar I opened the table. I would like to create a button that downloads this table and saves as . xls Can…