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
votes0
answers20
viewsHow to query data saved in JSON in . Net Core’s Dbcontext
Hello, I’m having a question regarding how to query a list or even a single record that was saved in the database in JSON format. For example. These are the data saved in JSON format in the…
-
1
votes2
answers60
viewsSearch for inconsistency in a C#list
Good afternoon. I have a list of the Project class The Project class has the properties: public string ID { get; set; } public string Nome_Usuario { get; set; } public string Nome_Projeto { get;…
-
1
votes1
answer63
viewsTime table with 8 variables
I have a difficult question, I have 8 teams in a table, I have simulated the results but I need to update the table using the points, so I know the amount of points of each team I wrote the…
c#asked 7 years, 6 months ago Kaue Camelo 13 -
1
votes0
answers44
viewsHow to publish an ASP.NET (.NET Framework) project without the iis dependency
I have a project working but with the dependency of IIS. In some researches I found the possibility of making the project self host. As in the link: http://www.macoratti.net/18/05/net_conc3.htm But…
-
1
votes2
answers1676
viewsLogin in C# with database
I’m trying to make a login panel, but it doesn’t recognize the data recorded in the database. Code: SqlConnection con = new SqlConnection(@"Data…
-
1
votes2
answers1595
viewsCheck if there is value in List
I’m trying to make a condition, where I would check, whether in a List there is a value, so I created the following: private void Itens_Edit(object sender, EventArgs e) { if(editar == 1) { int a =…
-
1
votes2
answers88
viewsHow to print a decimal value with comma ex: 75.0 would be 7.5?
using System; class teste { static void Main(string[] args) { float nota1, nota2, MEDIA; med1; nota1=float.Parse(Console.ReadLine()); …
-
1
votes1
answer23
viewsChange font color for a Datagridview column
I’m trying to change the font color only give cell of a column that contains "x" value... but I’m only able to change the whole row... I tried to make only cell but without success, follow code used…
c#asked 3 years, 9 months ago Caio Cesar 51 -
1
votes1
answer365
viewsHow to locate an object by name only?
I’m 6 PictureBox, then, when saving the photo in the database, save together in which PictureBox she was. So when uploading the photos in a view, I need each photo to be displayed in its respective…
-
1
votes1
answer50
viewsForearch loop how to use with controler
I’m 6 PictureEdit in a PanelControl, and I need to make a run at all the PictureEdit then I made the following code: foreach (PictureEdit Pic in panel1.Controls) { //habilita o meno de zoom…
-
1
votes1
answer151
viewsHow to register a user with Identity, with the data already entered?
I have a method that inserts several data from an excel spreadsheet into the database, but there are some data, such as email, password, or concurrencyStamp (set as NULL), so I can’t change users'…
-
1
votes1
answer66
viewsHow to recover all checkbox
In the code below, I have already tried to recover all the checkbox but I can’t bring anything, I would not like to put the ID, but recover numerous checkbox selected, how can I do? I put only 2 as…
-
1
votes2
answers161
viewsOracle DB and MVC 4 showing ORA-06413 error
I’m having a problem very similar to this one. To summarize, I have an application that runs with ASP.NET MVC 4, using . NET Framework 4.0, using the same DLL of access to Oracle,…
-
1
votes0
answers36
viewsMy bootstrap logo is too big and the rest of the menus have a large empty space between them
<body> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed"…
-
1
votes1
answer33
viewsHow to receive querystring value in an action?
I am creating an API with ASP.NET Core and would like to know how to do a search via querystring, in case the URL sees something like /api/programas?nome=teste Like I would in my controller? Example…
-
1
votes1
answer44
viewsVerifying existence of shortcut
I need to verify the existence of a shortcut on the desktop of the computer, but the code below does not leave the if (!File.Exists(pasta)) private void Instalando() { string pasta =…
-
1
votes1
answer468
viewsChange the color of a Webgrid mvc <td> tag
That’s the WebGrid and I need to change the background color of Celula filled in "IN PROCESSING": for Red: CSS <style type="text/css"> .grid { margin: 4px; border-collapse: collapse; width:…
-
1
votes2
answers1052
viewsUnity installation is giving error
I went to install Unity for DI and the Nuget is giving an error, I did not understand, it seems to me that it points to the Newtonsoft, see the error below: Install-Package : An error occurred while…
-
1
votes3
answers229
viewsConvert the string "5.541.00" to int in C#
What is the correct way to convert a string with the text "5.541,88" to int? I’m trying to do it this way: int valor = int.Parse("5.541,88"); But I can’t because it returns the error: Input string…
-
1
votes0
answers268
viewsHow to hide URL parameters on an ASP.NET MVC 4 site
I have a question, studying the competition, I realized that when you click an image within the search result, or they pass a parameter to the Viewthus: So far so good, I can do, but I don’t think…
-
1
votes0
answers17
viewsValidation ASP MVC 5
public class HomeController : Controller { private ProjetoFornecedorEntities db = new ProjetoFornecedorEntities(); // GET: Home public ActionResult Index(Fornecedor fornecedor) { return…
c#asked 7 years, 6 months ago Robson Oliveira 155 -
1
votes0
answers14
viewsCommunication with Arduino via await async . NET
Good afternoon! I’m studying the best way to communicate my web project with an Arduino board. So far I’ve managed SEND an asynchronous form of a command, according to the code below: //metodo para…
-
1
votes1
answer276
viewsMany To Many Entity Framework Update
I’m having trouble at the time of updating with relationship Many to Many. I want the update method to update all itemEntity fields as well as vendors. For example I only put the description field…
-
1
votes1
answer194
viewsClick windows transparent form C#
I have a transparent windows form for drawing on other screens. For transparency, I used the following code: BackColor = Color.Red; TransparencyKey = Color.Red; It worked for a while, but now it…
-
1
votes1
answer44
viewsFiltering items in a products table
Good afternoon to everyone, I have a simple application that I am developing, and I have the following problem, I have a variable "Tenure List", which already has the ID of the items, and I have a…
c# sql-server entity-framework winforms visual-studioasked 3 years, 5 months ago Mecleudio Queiroz 31 -
1
votes2
answers682
viewsTransfer of Socket Files c#
I have the following situation, I need to transfer an xml from one application to another via network (Socket) set up the methods of client and server which I will post just below, The file is…
-
1
votes1
answer158
viewsSecure Application
I am developing a system that will be used in my work to control the machines, I finished the first step, now began the testing. As in my machine I do not use antivirus I had no problem in this…
-
1
votes3
answers99
viewsProblems with View Model Implementation
I’m trying to use the concept of View Model Pattern, but when I’m implementing the compiler is showing a conversion error. Below follows the approach I used: Structure of the viewmodel public class…
-
1
votes0
answers261
viewsAccess-Control-Allow-Origin in different environments
I have a very strange problem: the same code works locally and in Prod, but does not work in Homolog. Basically, the problem is Homolog (logo on login) is this: Xmlhttprequest cannot load…
-
1
votes1
answer24
viewsFind Normalizedusername of Identity . NET core on the Azor pages
I need to display the user name on topbar. Razor by default provides a @User object as default but providing little user information. It has the name property but brings the username instead of the…
-
1
votes2
answers112
viewsStrange Behavior in Entityframework with Storedprocedure?
I’m conducting a search through StoredProcedures in the EntityFramework and the field of Data this presenting error conversion to type String. Method public IEnumerable…
-
1
votes1
answer78
viewsError creating Extension for Datagridview C#?
I’ve used Xtensions for other components and did not give this problem, is giving the error only with the DataGridView. The component finds the extension, and not the error, the error shows only…
-
1
votes0
answers55
viewsList of int in delegate Func<> not working
I am studying something and I have come across the following problem. I create a list of 7 elements and treat it within an Func<> works, but if I increase the list items, then my method does…
-
1
votes0
answers97
viewsJson deserialization with Datacontractjsonserializer Null Pointer Exception
At first I’m doing a test if I can communicate properly with the Wikipedia API. My first goal is to take data from the API, turn it into an object and present something on the screen that…
-
1
votes1
answer767
viewsNewtonsoft.Json.Jsonreaderexception When making a POST
I’m having trouble doing the post in my API my app up to register the object but then it locks the application and closes with this error of execution: Newtonsoft.Json.Jsonreaderexception:…
-
1
votes2
answers1397
viewsAdding multiple Gridview lines
I’m trying to include several lines in a Gridview, but it doesn’t add the lines, it always replaces the first. I would like to know how to make it add several lines, and not replacing the first.…
-
1
votes1
answer798
viewsHow to bring information by clicking on the dataGridView C#, and adding values from a column
Hello I’m having difficulty creating a query of a gridview used Entity Framework Well, I have a gridView she carries the data normally In the Textbox below I want to take the name of the person that…
-
1
votes0
answers137
viewsMore than one query in a very slow request in the first C#request
I have a method that requests data from the database and in this same method I call another method that also requests the database (mysql). public class Viagem { public int idViagem { get; set; }…
-
1
votes1
answer920
viewsSave an HTML - possibly dangerous value Request.Form
I have a Textareafor that receives an HTML content, when trying to record I have an error, I added in web.config the pages validateRequest="false" I’ve tested the common text Insert and it works,…
-
1
votes1
answer557
viewsCompare Textbox with field in a Sqlserver table
I’m stuck on this if. I want to compare my textbox with a field in a sql server, but I don’t know how to continue. follows the code: using (SqlConnection connection = new…
-
1
votes2
answers1808
viewssecond degree equation c#
I made this code to calculate bhaskara, but it is not answering anything for the values a=1, b=8 and c=16. I cannot understand why it is not working specifically for these values. using System;…
c#asked 7 years, 5 months ago Paulo Sérgio 13 -
1
votes1
answer55
viewsRelationship of Fluentapi Tables
I am trying to make a relationship of tables, using Fluentapi with Entity Framework, in which my purpose are 3 entities: public class Empresa { public Empresa() { this.Gerentes = new…
-
1
votes1
answer406
viewsSend data from a Gridview in a Form to Combobox in another Form
I’m trying to send the data of a gridviewin a second Formfor a comboboxin the form but I haven’t been successful. I wonder if there is a way to do this without sending as a parameter, since I will…
-
1
votes1
answer573
viewsDo not reload page when giving Submit in modal
I have a modal to research customers: Which is called a registration form as follows: $('#linkSearchShipperCustomer').on("click", function (e) { showDialogList("@Url.Action("IndexShadow",…
-
1
votes3
answers1452
viewsHow to create a category tree in C#
Database I have a database with product and service codes (for public tenders) and wanted to find a way to create a "tree" for these codes. See how I have configured my database in the following…
-
1
votes2
answers281
viewsSend data to an Actionresult from a Controller other than the current one
How to make a post sending data to a ActionResult of a Controller different from the current ? Example: I have a link called lnkEnviarDados and I need to post on the page sending the contents of the…
-
1
votes2
answers185
viewsEntity Framework - rename Foreignkey
I have the classes: [Table("Editora")] public class Editora { [Key] public int EditoraID { get; set; } public string nome { get; set; } public List<Livro> livros { get; set; } public…
-
1
votes1
answer143
viewsValidation of the repeated registration
I have a class called Matricula. She gets a record of Aluno and of Serie. I need to do a validation, where if the student is already enrolled in a registered series, the page presents a message…
-
1
votes1
answer20
viewsVariable content is not displayed in the View
Instead of displaying the value of item.Endereco in Webgrid what is displayed is a text @item.Endereco.Length > 0 ? item.Endereco.Substring(0, item.Endereco.Length - 3) item: item.. In my current…
-
1
votes1
answer347
viewsImprove performance when generating excel spreadsheet
I’m using this generated NPOI to create excel spreadsheets and am facing the following problem: The generated spreadsheet has 300 lines and takes 1 minute to be generated and sometimes error…