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
votes2
answers754
viewsLoop for ATM
I need to run this code until user asks to quit. In case, it will inform the result at the end and follow up with a question to the user if he wants to continue using, then the code runs again until…
-
1
votes1
answer374
viewsExceeded timeout trying to send email c# windows Forms
I’m trying to create an application to send emails of "I forgot the password" but without success so far I posted here a problem where the screen was freezing and it was time exceeded application, I…
-
1
votes2
answers151
viewsHow do I use two checkboxes in a C# mvc view to choose the query type?
Controller.cs public ActionResult pesquisarCliente(string _codigo) { var r = db.Pedido.AsQueryable(); if (!string.IsNullOrEmpty(_codigo)) { r = r.Where(n => n.Cliente.Contains(_codigo));…
-
1
votes0
answers88
viewsRoute is not being located on my site, but works on localhost
I have a service, with verbs GET and PUT. On localhost is ok, but when I host on my site I get this mistake, only when I call the PUT: IIS 7.5 Detailed Error - 404.6 - Not Found According to the…
-
1
votes1
answer174
viewsCall PUT method from an Xamarin.Forms App
I need to do an update of mine App. I’m having some doubts to pass the proper parameters to the URL of the service and perform the PUT. The service is working, testing by Postman, I can perform the…
-
1
votes1
answer616
viewsHow to perform sum per line on a datagridview in c#
Good afternoon, I need a help, I have a datagridview that contains a Type Coin column and a Total Currency column. In the Currency Type column I can have up to 3 types of currency, euro currency,…
c#asked 7 years, 2 months ago Junior Guerreiro 617 -
1
votes1
answer121
viewsTo create a list where you list all existing items within an order
I have the following screen that generates when making a request. On the field Order items, I need you to separate by items and not lump into one. Example as it is currently coming out It’s bringing…
-
1
votes0
answers97
views -
1
votes1
answer47
viewsHow do users' Sids work?
I need to implement an authentication system written in C#. NET based on users of Windows, so it will be authenticated according to some identification only of users. The problem is that the only…
-
1
votes1
answer26
viewsHow to work with Datagridviewcheckbox using a chekBox apart that allows enabling and disabling all Datagridview fields?
I’m having a hard time working with Datagridviewcheckbox using a chekBox apart, almost everything is working in normality, the problem is when using the option to select everything, which is the…
c#asked 7 years, 2 months ago António Mateta 159 -
1
votes3
answers335
viewsDynamic path C#
I am in search of a way to leave the path of a file inside my project in a dynamic way, currently this so: string arquivoImagem =…
-
1
votes1
answer36
viewsUse the value of a constant to set a property in the mapping with EF Core
I am mapping a class (System) in EF Core, but I would like to create constants for the size of the characters, because when I go to map the class, I would just change the value of the constant and…
-
1
votes1
answer459
viewsDatagridview.Cellclick event
How can I use the event DataGridView.CellClick to click a single column? The way I did in my code if I click any part of the datagrid it does the action, and I didn’t want it to be this way I want…
-
1
votes1
answer83
viewsDisappearing image
I have 3 buttons with images that I position in the upper right corner of the screen. If I maximize the screen for only one monitor the images appear correctly, but when I maximize for two monitors…
-
1
votes1
answer479
viewsHow to publish a Webservice using Visual Studio C#?
I’m trying to publish a Webservice with Visual Studio but the connection is failing. Someone can help me connect on this project? Here’s the error message from when I try to publish: Publishing…
-
1
votes1
answer92
viewsWhen clicking the button check whether the value of the textbox contains in a table column
How can I check the textbox if it contains this value within the table in the Database column when clicking the button? I made this code, but I didn’t succeed: SqlConnection conn = new…
-
1
votes1
answer234
viewsC# MVC5 EF - How not to lose data after Modelstate validation?
below my question if you can help. I use C# ASP.NET MVC 5 with Entity Framework. I have classes that represent below respectively a customer registration and an email registration: public partial…
-
1
votes1
answer170
viewsLinq to sql with subquery
I have two tables, and would like to get only the data from table A, filtering by related table B. I would like to know how to write this query with Linq to Sql in C#. I wrote the example below in…
-
1
votes1
answer112
viewsPassing array list by parameter
I have the following problem: I need to pass some files (xmls and pdf) from my winforms application to a webservice. The problem is that it is not possible to pass via parameters to a WS data type…
-
1
votes0
answers259
viewsHow to edit data from a table in a modal bootstrap?
How to load a modal bootstrap through a link within a tag < td > and send together column value Code, Name and Date example: jquery: $(document).on("click", "#lnkEditar", function () {…
-
1
votes1
answer1942
viewsTRANSACTION - How to correct a shipping error?
I think you can understand what I’m trying to do there: This method will make a foreach for each item in my movement list, and send each as a parameter to the method that will save them in the BD. I…
-
1
votes1
answer113
viewsUse synchronous or asynchronous tasks to collect print counters
I am trying to develop a process that performs the collection of some printers counters via SNMP protocol, I thought to use Threads to perform this process, refatorei to use tasks, but I do not know…
-
1
votes1
answer87
viewsHow to write data from an excel to an xml file
I would like to be developing a program that has to read excel files and write to an xml file but I don’t know how to write the data to the xml file. I’m reading the excel file like this : var…
-
1
votes1
answer49
viewsUpdate only a property of an object using Outputcache in Actionresult
Hello, everybody. I’ve got a problem I don’t even know if there’s a solution like this. I have an Actionresult that returns the contents of a chart in Jquery. The result of this chart will always…
-
1
votes0
answers41
viewsHow to return undeclared View values in Model to Contoller by post method
My controller is declared as code below: public ActionResult Create([Bind(Include = "a,b,c,d,e")] Proposal proposal, int prjId, int[] array) { if (ModelState.IsValid) { proposal.f = prjId;…
-
1
votes1
answer595
viewsMy notifications are not coming and I think my code may be correct
I made several attempts to send Push Notification and none of them I was able to view in my App. I always thought until now, that I was wrong. But I followed two steps and saw that with the guys it…
-
1
votes0
answers272
viewsC# - 5 significant numbers with at least 2 decimal places
Guys, someone knows a way that I can transform a number with at least 5 significant digits and added to this factor, it should have at least 2 decimal places. Example: -0,00012 >> -0,00012000…
-
1
votes1
answer256
viewsDisable Lazy Loading for a specific query
I have a problem of slowness at the time of bringing the data. I have in the table 16 thousand records that are taking about 6 seconds to be brought from the bank. I noticed that when bringing these…
-
1
votes0
answers47
viewsJSON for websocket gives error
I send a JSON to the websocket. JSON and sending is set like this: var binary = btoa(Uint8ToString(view)); var toSend = { 'fileName': fileName, 'sequence': SendedChunks, 'data': binary.toString() };…
-
1
votes2
answers241
viewsValidation in Edit and Delete operations by ID at url
I tested by taking the id and passing via url, normally performs the operation as long as it exists, otherwise error as expected. EX: http://localhost:55199/Person/Delete/7…
-
1
votes1
answer1668
viewsindex outside range c#
I am trying to make an assignment of value in a certain index of a String, however, I get the following error that I do not understand the reason: System.Argued tofrangeexception: 'The index was out…
-
1
votes1
answer169
viewsError While Running Migrations
Friends, I have two entities Deliveryfee and City, where Deliveryfee has a FK from City, when I went to withdraw the relationship between the two and ran the Migration he returned me the following…
c# asp.net-mvc entity-framework asp.net-web-api migrationsasked 7 years, 1 month ago Thiago Ubiratan 353 -
1
votes1
answer992
viewsCheck if there is value in the enumeration by the attribute and return its value
It is possible to produce simpler code for this function without changing the enum? /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]…
-
1
votes1
answer2364
viewsThe template item inserted in the dictionary is of type 'System.Collections.Generic.List`
I am developing a project where I have the Patient class inherited from the User class and I am using the Entity Framework to map the database tables by type (TPT), when I try to access the Patient…
-
1
votes1
answer66
viewsNota1 and nota2 show errors and do not view storage in the array. Can anyone help? Thank you very much
namespace mediaDe5Alunos { class Program /*faça um programa para cálcular a média de duas notas de 5 alunos, mostrar a média da sala e de cada aluno e um relatório dos alunos*/ …
-
1
votes2
answers51
viewsFiltering through empty children
I have two entities (TipoDeRequerimento and TipoRequerimentoSituaçãoAcademica) in my query. Today I can make a filter to bring the Types of requirements that have a certain academic situation…
c# asp.net-mvc asp.net-web-api lambda-expressions linq-to-entitiesasked 7 years, 1 month ago Thiago Ubiratan 353 -
1
votes2
answers241
viewsPopular Datagrid Combobox Windows Forms C#
I have a datagrid(c# windows Forms) that I need to use for editing and I am populating with information coming from the database of a table called "costs" The Account Plan and Cost Center fields are…
-
1
votes0
answers37
viewsRecording of Datacard using Ibidispl interface
Hello, I’m developing a c# application to record data to smartcards via Datacard SD360 printer. After downloading the SDK provided by the manufacturer (this link:…
-
1
votes1
answer73
viewsUse of Eval to transform Razor to Javascript
Before criticizing the use of eval, I read and recommend that answer. Take into account the following context: Code C# (Razor): var teste = new { prop1 = 123, prop2 = "minha mãe disse 'Háaaaaa!'" };…
-
1
votes1
answer210
viewsEviar view parameter for action
I have a views that lists my users, is basically in the pattern generated by Asp.net mvc with Entity, the data is in a table, and within this table I have a : @Html.ActionLink("Aprovar cadastro",…
-
1
votes1
answer114
viewsError trying to change a user’s role
I am getting the following error while trying to change a user’s role : Server Error in Application '/'. UserId não encontrada. Descrição: Ocorreu uma exceção sem tratamento durante a execução da…
-
1
votes1
answer687
viewsOpen and close connection each time you run the looping
I have an application that runs a procedure, saved in a DataTable and then do a looping to add the data in an excel spreadsheet. My question is, if I open and close the connection to each insert…
-
1
votes1
answer82
viewsHow to treat an index band exception?
I’m having an exception problem on my show and I’m not sure how to treat it. Follow the error image in Datagridview. private void DGW_solictacao_CellClick(object sender, DataGridViewCellEventArgs e)…
-
1
votes2
answers3639
viewsExport of CSV data
Personal someone would have some example of how to create a web data export on . CSV? I already have one on my system on . XLS, but I need to modify it, someone can help? Controller private void…
-
1
votes1
answer231
viewsHow to navigate to another page using Webbrowser?
I am trying to access a URL and send login and password for authentication and then browse between pages? After I log in to the page http://indigo.rafson.com.br, I’m not getting switched to another…
-
1
votes1
answer747
viewsBest way to implement Toledo Prix 4Uno scale?
Good afternoon, I acquired a Prix 4Uno scale with communication via ethernet. I wonder if there are examples in C# to implement communication with it, or if it is only via MGV 6 software. Any…
-
1
votes0
answers47
viewsTo the popular the list, is coming null
In my App I populate two grids. That’s ok. I take the data of a service, that way: dataGrid.ItemsSource = await dataService.GetLiberaAsync(); itensGrid.ItemsSource = await…
-
1
votes2
answers84
viewsComparing two objects and copying conditionally
I have the following classes: public class Pessoal { public int ID { get; set; } public string CPF { get; set; } public string PIS { get; set; } public string NOME { get; set; } ... ... ... } public…
-
1
votes1
answer907
viewsSend email to create commitment in Google Calendar
I have a C# ASP.NET MVC application, in which the user can schedule an appointment. In this application he chooses a text for the commitment, a Date to happen and also chooses, the sooner he wants…
-
1
votes0
answers46
viewsDevelop Plugin for Windows Desktop
I am developing a Cordova plugin for windows desktop and need to use some native functions, I will have to use Windows Runtime. I started by following a tutorial and I have the following structure:…