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
-
0
votes0
answers54
viewsRelationship of two Tables with a Dataset containing two Tables
Good Afternoon everyone I need help to do the relationship of two tables, to click on the Dg_title Datagridview, appear in the Dg_number below the installments of each title. I want to create the…
c#asked 6 years ago Flavio Rocha 2018 1 -
0
votes1
answer389
viewsWrite a Json string to the database c#
I am able to receive the data correctly, and being able to separate them correctly too, only problem is that I do not know how to use the values and be able to write in the database, could help me ?…
-
0
votes1
answer41
viewsMove Textbox created by code
I’m trying to move a Textbox that was created via code, down. Follow the code where I create and add the button: private DVJPetControles.TextBox txtHorarioCheckin; this.txtHorarioCheckin.TituloLabel…
-
0
votes0
answers40
viewsAdding Watermark with c# without using System.Drawing.Bitmap in Azure
I am new in the world . NET and I have a problem sending images to the site. I am using a function to add Watermark to the photo as soon as it is sent but apparently Azure no longer accepts the use…
-
0
votes0
answers57
viewsxls created through C#, but does not add values
I have a method that generates excel(. xls), but I have a problem: excel is being generated perfectly, but when I try to add up the values of cells nothing happens, it only adds up if I open cell by…
-
0
votes1
answer81
viewsDatabase connection object: Should I only have one for the whole system or one instance per class?
What is the best practice: to have only one point (Singleton) that returns the connections to the database or to create an instance of the connection for each object? My system accesses several…
-
0
votes1
answer61
viewsDoubt with Asp.NET MVC Update
Sorry for the question, I am learning Asp.NET with EF and am having problems performing a specific Update. I want to make a system where there are cash transactions between accounts. The structural…
-
0
votes1
answer141
viewsC# Web API 2 - AJAX Request for PUT method returning 405 (Method Not Allowed)
Good morning! I am building a system using C# as back and React on the front, and I have a problem in two controllers (supposedly), but the error seems to be the same, and whenever I make an AJAX…
-
0
votes1
answer34
viewsSerialize everything in a single line
I am generating an xml of an Nfse, but I need everything generated in a single line, even when generating the signature. When I serialize, I do it this way: StringWriter sw = new StringWriter();…
-
0
votes1
answer361
viewsGraphic creation c#
Good afternoon friends, I am creating a program in c# that should plot in a graph the current values of the serial port (Arduino) in a picture box. To draw the graph I am creating points(x,y) and…
-
0
votes1
answer44
viewsCompare existence of record with date and future date
I have the following model public class AgendaExame { public int Id {get; set;} public int PacienteId {get; set;} public int ExameId {get; set;} public DateTime Data {get; set;} public DateTime…
-
0
votes1
answer125
viewsChoosing Certificate through CNPJ
I have this function which searches the certificate by serial: public static X509Certificate2 EscolherCertificado() { var store = new X509Store("MY", StoreLocation.CurrentUser); X509Certificate2…
-
0
votes1
answer275
viewsDropdownlist with Selectlist Item
I am trying to create a Select List, but in case it is returning it to my view: Microsoft.AspNetCore.Mvc.Rendering.Selectlistitem so is not returning the Cargos that are in my database and here are…
c# asp.net asp.net-mvc-5 asp.net-core entity-framework-coreasked 5 years, 11 months ago Matheus 616 -
0
votes1
answer75
viewsGenerate list dynamically with Linq
I have an API that uses Dotnet’s Dynamic to generate billets. The documentation is as follows: dynamic endpoints = new Endpoints("client_id", "client_secret", true); var body = new { items = new[] {…
-
0
votes1
answer307
viewsCalling a Modal via Html.Actionlink
I have a screen that makes the user password exchange. This screen shows the user name and when clicking on the name, it is directed to the screen to exchange password. As I would make this call…
-
0
votes2
answers1395
viewsHow to pick up items from a json in c#
After almost 3 days trying to implement I did not succeed. I have the following json: { "code": 200, "data": [ { "id": 1, "type": "charge", "custom_id": "1208", "status": { "current": "new",…
-
0
votes0
answers63
viewsProblems sending Nfe 4.0 to SP, MT and MS states
I have problems sending the disabling of Nfe 4.0 only to the states of SP, MT and MS. The others are sending normally. Is giving error in this part of the code: HttpWebResponse responsePost =…
-
0
votes1
answer93
viewsPass list to model
I have a query that returns me a list this way: var list = db.Comentario.Where(d => d.GrupoTrabalhoId == Id).OrderByDescending(s => s.DataComentario).ToList(); After this query, she will…
-
0
votes0
answers63
viewsWhat’s wrong with my Update?
Good morning. I’m a beginner and I’m having problems with my Update. I wonder what I’m doing wrong. public string Update(Usuario usuario) { var sql = new StringBuilder(); sql.Append("UPDATE TBUSU…
-
0
votes1
answer64
viewsExit a method call cycle
Let’s imagine the following situation: A company has the policy of donating 3% of its profit to social projects, and this amount donated should come as an expense to the company in the period.…
-
0
votes1
answer149
viewsHow to detect navigation using the Webbrowser class and capture information with C#
Hello, I’m doing an integration with the Free Market API, where I need to open a browser screen with the page for the user to allow access to my application’s API (as the documentation here). To do…
-
0
votes1
answer174
viewsSave as txt c#
I created a method that saves a txt in the user’s temp folder, but I would like the user to choose where to save to his machine (save as). How could I do that? Below is my code: protected void…
-
0
votes1
answer93
viewsX509certificate2ui.Selectfromcollection is closing the application
In a particular client, when accessing the function X509Certificate2UI.SelectFromCollection the application is closing without even passing the error handling. This function opens a Windows dialog…
-
0
votes1
answer40
viewsCannot Rename a null token Parameter name: token
Follow the extension: public static void Rename(this JToken token, string newName) { if (token == null) throw new ArgumentNullException("token", "Cannot rename a null token"); JProperty property; if…
-
0
votes1
answer1087
viewsSerialize XML for special characters
I get an Nfse XML, but I need to handle the special characters, example: ´^~Ç etc, I serializo it this way: StringWriter sw = new StringWriter(); XmlTextWriter tw = new XmlTextWriter(sw);…
-
0
votes0
answers196
viewsConvert RTF to String via SQL?
Good staff I have a small problem, I was asked to do it through SQL to convert a text made through a Richtextbox (VB 6) to normal string, but is that this Richtextbox also serves to by Chinese…
-
0
votes1
answer337
viewsC# - EFD Reinf v1_04_00 - How to instantiate and fill in all Events properties?
After my question answered here: EFD-Reinf - Invalid batch version. Version 1.04.00 must be used And in the question: REINF - Invalid Signature It was clarified that I need to serialize xml. Through…
-
0
votes1
answer468
viewsConvert Json to a Csharp Object
public IActionResult MoedaTurismo() { try { RestClient restClient = new RestClient(); RestRequest restRequest = new RestRequest(); restRequest.AddHeader("cache-control", "no-cache");…
-
0
votes0
answers68
viewsEntity Framework 6 catch attributes in Savechanges
I’m using the Entity Framework 6 with Oracle. The database is of a legacy system, I intend to set in hand the primary keys of the records. To make life easier, I want to take SaveChanges of…
-
0
votes1
answer54
viewsError when serializing with namespace in if
I was creating a file and it worked normal, but now, when serialize appears Q1 in all tags, I’m doing this way: StringWriter sw = new StringWriter(); XmlTextWriter tw = new XmlTextWriter(sw);…
-
0
votes0
answers23
viewsHow to create the event for a textbox in Runtime?
foreach (SobralFoodContext.Produto produtos in categoria) { string str = "<div class=\"col-sm-4\"><div class=\"card\"><div class=\"pricing-list dark-pricing\"><div…
-
0
votes1
answer233
viewsC# - EFD Reinf v1_04_00 - return - nrProtEntr - return treatment
After successfully sending the R1000 event, through the questions: C# - EFD Reinf v1_04_00 - How to instantiate and fill all Event properties? How to consume EFD-Reinf Webservice in C#? (Sending…
-
0
votes1
answer243
viewsPass value from a select to Html.Beginforms - Asp . Net
I have that element <select>: <select id="status" class="form-control form-control-sm" name="arquivo" > @{ foreach (string valor in ViewBag.ListaArquivos) { <option…
-
0
votes1
answer105
viewsUpdate Role of the ASP.NET Identity user
hello guys I am finding it difficult to update the user role when updating my data, my roles are being filled by a Viewbag in my get from my controller and I am retrieving the new ID from my…
c# asp.net-mvc asp.net-mvc-5 asp.net-web-api asp.net-coreasked 5 years, 11 months ago Thiago Ubiratan 353 -
0
votes1
answer63
viewsJson Line error 0 position 0
I have looked here on the website about this error and so far I have not found anything to solve my problem. I’m trying to use restsharp, but I’m getting an error when passing the data to . json My…
-
0
votes1
answer81
viewsExchange Html.Action() for an Ajax request
I have a method that returns a ActionResult called through a Html.Action() directly on View using Razor. This method is used to render a ComboBox of devExpress with the data I send a command SQL at…
-
0
votes1
answer45
viewsConsult validity with two dates using Ef 6
I have the following model: public class Documento { public int Id {get;set;} public int ClienteId {get;set;} public int TipoDocumentoId {get;set;} public DateTime Emissao {get;set;} public DateTime…
-
0
votes1
answer112
viewsCreate new directory according to string
I have a function that saves an image in a default directory, for all companies, and I tried to change this to save in a directory according to this string companyFolderwhich I have created. Yet you…
-
0
votes2
answers224
viewsException treatment not working
Hello, I am studying C# and I was trying to do exception treatment using middleware, to send the message and the exception code to the client, but it is not working very well. Debugging, breakpoint…
-
0
votes1
answer67
viewsClear a listview that is inflated with an Inflater layout, Android C#
Good am with the following problem, I used a layout inflater to fill a listview with a adapter but I want to clean this adapter, because the products contained in the list does not change when I…
-
0
votes0
answers87
viewsReturn Iobservable in a method
I have a method that needs to return an Iobservable, but I’m having a lot of trouble. There is little content regarding this interface and what I find requires the use of the Reactive extension…
-
0
votes1
answer135
viewsC# convert Array for insertion in the database
I have a Array, some of the values of this array will be added as float others like int, my doubt is the following, as I can convert only one array not the whole list? I would have to create a…
-
0
votes2
answers44
viewsInserting data from a datagridview c# in another datagridview giving 2 clicks
I’m setting up a sales system. On the sales screen I own 2 datagridview Being the 1st (product research) where I receive the data of the product research, and the 2nd (selected products) will be…
-
0
votes1
answer141
viewsRegex to extract HTML information
I am trying to extract information that comes from reading email. However when you pass the match line, it pops the following error: {"analyzing "(?si:(Information Type[ d]+(?[ d]+)|Information…
-
0
votes1
answer304
viewsAvoid duplicated id in list c#
I am doing a list exercise where I have to enter the employee id, but there should be no repetition of id. I would like to know how to use the foreach to avoid checking and blocking if a repeated…
c#asked 5 years, 10 months ago Victor Marcantonio 1 -
0
votes2
answers799
viewsRead multiple text files using System.IO and Visual C# . NET and writing to these files
My problem is this. I have several . txt files in a pc directory. These files have information on each line and have blank lines. What I would need to do is read all the files in the directory, open…
-
0
votes0
answers82
viewsValidation with Modelstate
I have a web application in . NET Framework 4.6.1 with a method similar to the one shown below: public class MeuControladorController : ApiController { public IHttpActionResult…
-
0
votes1
answer66
viewsMicrosoft Faceid - Instantiating Faceclient
Hello, I am developing an application using the Microsoft cognitive services in specific Faceid, however I have a problem in the library startup, I took this code in the Microsoft site itself:…
-
0
votes1
answer172
viewsHow to insert data into an N:N Table
I’m having trouble inserting data into an N:N table. The two tables in question are: Course and Subject. The relationship between them forms a table called tbMATERIA_CURSO which stores the primary…
-
0
votes2
answers3490
viewsError uploading new version of an apk to google play console
I have an app already published and I want to publish a new version. While uploading apk I’m getting this error: Sending failed The APK or Android App Bundle must be named after package…