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
votes1
answer862
viewsHow to sign NF-e XML in ASP.NET Core using NF-e 4.00 signature standards?
I am developing an API with ASP.NET Core, communicating with Sefaz to send NF-and, however I am having a problem signing XML, below is the code that makes the signature: var listas =…
-
1
votes1
answer97
viewsInsert Dataset data into database
I have the following code: using System; using System.Linq; using FirebirdSql.Data.FirebirdClient; using System.Configuration; using System.Data; namespace TblCliente { public class Program { static…
c#asked 6 years, 2 months ago Charles Andrade 55 -
1
votes2
answers193
viewsTimeout Sql Server in a request via Web Api
Running the query gives a Timeout Sql Server error: Connection Method: public SqlDataReader GetDataReader(string comando) { SqlConnection conn = criaConexao(); // Cria Comando SqlCommand cmd = new…
-
1
votes1
answer57
viewsDatagridview with Custom Value Dataset
Hello, good morning, sir. I would like to ask you for help on the following situation: Use the Postgresql database integrated with Visual Studio Enterprise with the package (Npgsql Postgresql…
-
1
votes1
answer189
viewsHow do I pass a View value to the Controller in Asp.net core?
I want to go from View <table style="width:100%"> <tr> <th>Serviço</th> <th>Data</th> <th>Feito</th> </tr> @{ foreach (var item in…
-
1
votes3
answers277
viewsHow to concatenate sublists from a list and add values to them using Linq with C#
Hello, I have the following 2 classes: public class EstoqueItem { [Key] public int Id { get; set; } public decimal Qtd { get; set; } public Estoque Estoque { get; set;} } public class Estoque {…
-
1
votes0
answers238
viewsTaking information from an HTML page in C# (Webbrowser)
I’m trying to get information from a website and I’m having a hard time getting the right result. Basically, I need to get the software version on the site:…
-
1
votes1
answer84
viewsError - string C# for Crystal Report
When trying to pass the string from c# Windows Forms to Crystal Report following the procedure of the second image and the code below Crystal report shows the following error! Visual Studio…
-
1
votes2
answers89
viewsRename field in a lambda
In SQL I do so: select campo1 as teste from tabela And in a lambda? How would I do? I have this lambda with several tables and the field ValuePayment is repeated several times. var qry =…
-
1
votes2
answers1871
viewsWhat does "At Execution Time" mean?
Eae Galera all good? In my researches I always find references to the term "At runtime", But looking for the term to get more information, I can’t locate anything relevant. I’d like to understand…
c#asked 6 years, 2 months ago Nicolas Sylverio 167 -
1
votes1
answer123
viewsHow to ensure that the generated JSON does not return error to the Customer?
I created a Web API that returns a JSON and who is having a problem similar to the question JSONP: status code 200 OK and still returns $.Ajax(... error:Function()...). Client consumes the API with…
-
1
votes1
answer61
viewsDownload file with mvc is giving dick
I did several searches on the net to find a way to generate a spreadsheet and save to disk. As it comes to web, this can only be done via download, and all the examples searched (at least by me), I…
-
1
votes1
answer1719
viewsInconsistent accessibility: "value" parameter type is less accessible than "value" method
Inconsistent accessibility: "Iclientmanager" parameter type is less accessible than "Clientecontroller.Clientcontroller(Iclientmanager, Usermanager) Controller: public class ClientController :…
-
1
votes0
answers111
viewsFormat cell size in . csv files
Gero esse csv public ActionResult geraExcel() { List<vwFinancingReportViewModel> lista = new List<vwFinancingReportViewModel>(); lista = dadosPlanilha(); StringBuilder sb = new…
-
1
votes1
answer638
viewsGet value from a view field in a controller
From the answers here, I couldn’t catch it. I have this view @{ ViewBag.Title = "ExcelFinancing"; Layout = "~/Views/Shared/_Layout.cshtml"; } <!DOCTYPE html> <html lang="pt-br">…
-
1
votes2
answers1233
viewsPass Json object array to Controller C# . NET
I need to do a post, and so far I’m trying to do by AJAX to send an object to the Controller, but I’m having trouble receiving the object. View/html: <select name="Servers" id="servers"…
-
1
votes0
answers33
viewsDisplay two Actionresult from the same Controller on the Index page
I’m already displaying a table in Index, only I want to display another table from the same controller. I created a PartialView calling for PartCorteCabos() and created a view of it. I tried to make…
-
1
votes0
answers263
viewsReturning Error View after calling a Modal pop up
Hello, I have a problem with the front end of my application. I have the following method to return errors: public class ErrorController : Controller { //Erro 500 Servidor public ActionResult…
-
1
votes1
answer119
viewsProblem in FK name size
I have a WebApi to work with a Firebird 2.5, I used the EF at the time, but today I am presenting the following error "The name 'FK_ARRUMACAO_CHECKLIST_ARRUMACAO_ARRUMACAO_ID' is longer than…
c# entity-framework entity-framework-6 firebirdasked 6 years, 2 months ago Lucas Riechelmann Ramos 521 -
1
votes1
answer91
viewsHow to change background-color of a button inside an Iframe with Jquery
Good afternoon guys, I’m trying to perform a function inside an iframe to change the background-color of a button that is in another Iframe, I started to do but I’ve done several tests and I can’t…
-
1
votes2
answers350
viewsHow to configure Postgresql Autoincrement using EF Core
I have a table mapping (Entity Framework Core 2.0) in which the Id field needs to be Autoincrement. The problem is that Postgresql is starting with high value and often jumps to very high sequences,…
-
1
votes2
answers691
viewsLimit the number of characters in a textbox
I am simulating an electronic urn in C#. To limit data entry, I decided to create a "keyboard" from 0 to 9, for the insertion of votes. However, I’m having trouble limiting the amount of characters…
-
1
votes1
answer42
viewsWPF how to give Focus to previous Window?
Good staff, I have a window in Toolbox WindowStyle="ToolWindow" which only serves to give information to the user what is happening on BackgroundWorker But I am having a problem, I for example have…
-
1
votes2
answers80
viewsGenerate model-based Migration (Entity Framework)
I’m trying to generate a model-based Migration: [Key] public int Id { get; set; } [MaxLength(100)] public string NomeInstituicao_Fundamental { get; set; } public string AnoInicio_Fundamental { get;…
-
1
votes1
answer137
viewsNhibernate Querysyntaxexception
I am trying to return the amount of objects that a query will return. If I execute the following command: query.ToList().Count The value is returned successfully, but I execute the following…
-
1
votes1
answer49
viewsHow to write an Event without using visual studio (in .Cs or simply in a .txt file)
I’m trying to write in Eventargs() a Enter Event for TB1 (textbox) This code of Form1 (in Form1.Cs), would write it normally with the help of Designer: using System; using System.Windows.Forms;…
-
1
votes1
answer239
viewsJSON Regular Expression and Deserialization Dictionary
I am developing a system that receives JSON from several layouts for a single channel and the Router class must identify which layout is by regular expression and perform the deserialization for the…
-
1
votes1
answer58
viewsHow to fire multiple errors in a single data check using C#
I am creating a solution where I would like to keep all business rules within my models including the answer to errors. The problem is that I would also like to be able to capture multiple errors at…
-
1
votes1
answer55
viewsChange /controller? id=1 URL to /controller/1
In my view I have two buttons that pass parameters via GET to my controller index, the problem is that the URL does not stick to the traditional ? id=1 and I wanted to make it look like this:…
-
1
votes1
answer40
viewsDatabase First approach with Lazy Loading disabled?
I’m starting a project and the Sql Server already exists so I will take the approach Database First as an example of that article Entity Framework Tutorial. I’ll create the file .emdx and import the…
-
1
votes2
answers166
viewsHow to return the name of an instance of a class?
To avoid having to manually type the data after an update to the objects, I decided to create a method of type static to be accessed by passing the object as parameter. public static void…
-
1
votes2
answers1189
viewsJoin several PDF files into one
I am developing an application to join several pdfs in one, I managed to do through two uploads, however, I would like in one upload to be able to select several and unify the pdfs. Could someone…
-
1
votes0
answers44
viewsBug in listview ordering
I’ve tried this code but it doesn’t work perfectly, the . net framework is 4.5.1 The code of Sort using System; using System.Collections; using System.Windows.Forms; namespace mp3dll { ///…
c#asked 6 years, 1 month ago ricardospk__ 11 -
1
votes1
answer81
viewsHow to save Return from a Webservice to disk?
I need to save in the directory a return of a webservice. How do I save the value of this variable ret in an archive xml. Return: XML of type Results.xsd I tried so: WSHP.XMLServer ws = new…
c#asked 6 years, 1 month ago João Bosco 41 -
1
votes0
answers80
viewsProblem searching for zip code in Windows Forms
I added in a Windows Forms form the option to return the address through the zip code. I used a web service to obtain this data and added in the following method: private void ConsultaCEP() { var…
c#asked 6 years, 1 month ago Lillian Freire 11 -
1
votes2
answers265
viewsToken Webapi C# Auth
I am issuing token, but at the moment make a request with the token, returns the following message: "Message": "Authorization has been denied for this request." I am passing user and static password…
-
1
votes1
answer488
viewsRequests POST AJAX ASP net MVC
Good afternoon, I’m with a small doubt, I’m making a POST request with AJAX on ASP net MVC and it works normal, but in firefox I get an error on the console However, this error does not appear on…
-
1
votes1
answer2136
viewsDownload File on Asp net mvc
I have files that were uploaded to wwwroot/files/ folder of my project. I want to download these files but when I click on the button nothing happens. public ActionResult DownloadFile(string…
-
1
votes1
answer140
viewsProblems when creating crud, select and Insert works, delete and update does not
Good afternoon, I need help with a crud c# here is the code where the class is, the strange thing is that select and Insert are working normally, the problem is in update and delete //incluirCidade…
c#asked 6 years, 1 month ago Galvin Gprill 33 -
1
votes1
answer165
viewsI can’t fill a matrix
When I put fixed values in the size of the matrix I can fill it, but when I try to capture the values in matrices a message like this appears: The index was outside the matrix boundaries ` int a =…
-
1
votes1
answer795
viewsHow to enable CORS for web page access from a different domain, in Asp.Net MVC
I am developing an application that is communicating with Secure Pag Checkout through the Web Server url https://ws.sandbox.pagseguro.uol.com.br that is working perfectly, after making the payment…
-
1
votes1
answer2907
viewsError: System cannot find specified file [C#]
Win32exception (0x80004005): The system cannot find the file specified in System.Diagnostics.Process.Startwithcreateprocess(Processstartinfo startInfo) While trying to run a recently published…
-
1
votes1
answer654
viewsStandard constructor to calculate an employee’s annual salary in C#
I need to make a code that calculates the annual salary (float) from the months worked (int) and monthly salary (float), but it has to be using the constructor method. Here’s a code I made but it’s…
-
1
votes0
answers57
viewsIs it possible to simulate a C#FTP server?
I need to develop automated integration tests in an application whose features have external dependencies like FTP. I wonder if it is possible to simulate an FTP as well as to simulate a database…
-
1
votes1
answer86
views"Jsonresult" does not contain a constructor that accepts 0 arguments
I am trying to return a Jsonresult to my View, but it is returning the following error. "Jsonresult" does not contain a constructor that accepts 0 arguments You could help me friends ? [HttpGet]…
-
1
votes1
answer39
viewsCertain infinity looping input numbers
When I collect the number 14 in the input it goes into infinite looping, how can I solve this problem? using System; using System.Collections.Generic; using System.Linq; using System.Text; using…
c#asked 6 years, 1 month ago Nathalia Dias 139 -
1
votes2
answers1938
viewsGET service - System.Nullreferenceexception: 'Object Reference not set to an instance of an Object. '
I am acting in the creation of a service Get in ASP.NET Core, my project contains the following structure: Certidao.Data - Class Library Inside there is Dependences, Models: Sexo.cs and…
c# .net entity-framework asp.net-core nullpointerexceptionasked 6 years, 1 month ago Leandro Azevedo 303 -
1
votes1
answer8509
viewsHow to decrease the file size . zip generated by Dotnetzip?
Using the library Dotnetzip, I am zipping a folder with two image files (can be JPEG, EPS or AI) exactly equal (for test effect), each with 7.25 MB. I get the. zip file with the size of 14.3 MB.…
c#asked 6 years, 1 month ago Leonardo Bonetti 5,313 -
1
votes1
answer279
viewsError handling exceptions - "Undefined object reference for an instance of an object"
public String IdentificarAcessoDAL(FuncionarioDTO acesso) { try { conexao.cmd.Connection = conexao.conexao; string recuperar = "SELECT CARGO.NOME_CARGO FROM LOGIN INNER JOIN FUNCIONARIO ON…
-
1
votes1
answer328
viewsdataGridView with line break, but when exporting to excel no break
Galley, I have a dataGridView that used the following code snippet to break the text: dataGridView1.Columns[0].DefaultCellStyle.WrapMode = DataGridViewTriState.True;…