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
votes1
answer71
viewsHow to find the index of a Datarow by the value of a Datatable column
I have a difficulty regarding the combobox, I need to set a specific value for visualization, as if it were the function of visualization of an existing record, the value will be in the variable…
-
0
votes1
answer92
viewsHow to Recover C# Dynamic Fields for SQL
I’m making an ASP site that has dynamic fields in js: a = 0; function GetDynamicTextBox(value) { a++; return '<div class="container bg-light p-3 mb-2"><div class="form-group row…
-
0
votes1
answer167
viewsError When Mapping Idatareader with Automapper
I have this typing error when trying to map a Sqldatareader coming from a previous, mapping with Automapper Error An unhandled Exception of type 'Automapper.Automappermappingexception' occurred in…
-
0
votes0
answers40
viewsAutomapper mapping returns Zeroed values
I have the following problem, when executing a query of a procedure, its response to being mapped returns the values of the properties with null value. My Datareader with Automapper Mapping public…
-
0
votes1
answer77
views -
0
votes1
answer94
viewsInner John and Left John problem
I am using the Postgresql + C database# I have a Type that we can call Main. Inside it I have a long id, string name, I have a Classea, Classeb, Classec. Both the Classea, Classeb, Classec may or…
-
0
votes1
answer188
viewsHow to implement a text file export/import layer in DDD and how it will relate to the other layers
I’m basing myself on an Eduardo Pires project Here and I have some questions about implementing a unique layer for importing and exporting database information in csv, txt, xls, among others. For…
-
0
votes2
answers75
viewsGet an item from a referenced list
I am trying to get the items from a generic list that I pass for reference to a class, but I only have as return the name of my project concatenated with the class. Below is a code fragment…
-
0
votes1
answer53
viewsHow to wait for multiple tasks to finish to run the next line?
I have a button normal that performs three tasks, I want that when the tasks are running stay on the same line until the work is finished, without locking the program. I know there is a method of…
-
0
votes1
answer186
viewsAspnet Mvc Automated Routine
I have the class Clientefirm and the class Archivists one client has a list of tax files (a maximum of 12 per year, one per month) and one Archivist has a Client. public class ArquivosFiscais {…
-
0
votes0
answers40
viewsHTTP protocols
I’m new to development and I’m learning how to make a web service below this my method of consultation, insertion and removal. they are already working, however I wanted to know how to pass in the…
-
0
votes1
answer82
viewsGet the logged in user id
I found many questions of this kind here in Sopt but none that specifically talked about C# in Winforms. Well, I have a login screen and would like to pick up the id of that user who is currently…
-
0
votes1
answer83
viewsPagemodel.Page() is a method, which is not Valid in the Given context
I’m needing to use a script from an Alert() in my project . NET core Razor, and when I add the line: Page.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Hello…
-
0
votes1
answer195
viewsHow to take the content of a textarea and show in a modal
I wonder if I can take the content of a textarea (which in this case is a Texbox) and show in a modal, in my case: Follow the code I made: <asp:Label runat="server" CssClass="text-bold"…
-
0
votes0
answers41
viewsTreatment of exceptions of an Inputbox
I am doing an academic work where I have to pick up a data typed by the User and I am using a Inputbox for such. But the Inputbox displays several mistakes which I am not aware of. by clicking…
-
0
votes1
answer28
viewsI am doing a search system in my movie view and gave an error regarding the Web request
(I decided to make another post, as advice of another user) In my Movies view there is a list of all the movies you have in the database and I added um botão, uma caixa de texto e 2 radio…
-
0
votes2
answers1155
viewsHow to convert dd/MM/yyyy HH:mm:ss to yyyy-MM-dd HH:mm:ss
If I try to convert the date this way in Visual Studio works, but when I deploy the API (this already published) responds error 500. string added = "10/09/2018 10:20:11"; added =…
-
0
votes1
answer54
viewsCustomize ASP.NET Identity
I still only use the FormsAuthentication but I’m looking to migrate to the ASP.NET Identity in MVC. In my current projects, I don’t work with roles of FormsAuthentication, and yes by permission of…
-
0
votes0
answers30
viewsWhy is Httpclient Baseddres not working?
Below my code: using (var handler = new HttpClientHandler()) using (var client = new HttpClient(handler)) { client.BaseAddress = new Uri("http://localhost:porta/");…
c#asked 5 years, 5 months ago LeoHenrique 954 -
0
votes1
answer236
viewsInstantiating form to lock button
I’m instantiating a form with a single textbox just to put the password to release the button action. The button has the function of exporting the data contained in datagridview for a spreadsheet in…
-
0
votes1
answer61
viewsI would like to understand why when Modelstate is invalid, Viewmodel instantiation is "ignored" and form fields remain populated?
Follows my code: Subcategory Model public class SubCategoria { public int Id { get; set; } [Required(ErrorMessage = "Campo {0} é obrigatório")] [StringLength(200, ErrorMessage = "Campo {0} precisa…
-
0
votes0
answers31
viewsChekbox column in datagridview
I’m getting an error after I put a chekbox column in the datagridview on my screen, and this screen is loaded by a query, put this chekbox column not in the query but directly in the datagridview.…
-
0
votes1
answer37
viewsAbnormal error entering a Methodinfo page.Invoke "Parameter count error"
I’m calling the following function put it gives this problem "Parameter count error" when executing: url = (string)miScriptReference_GetUrl.Invoke(this, new object[] { scriptManager, value, false…
-
0
votes0
answers27
viewsData from datagridview going from one screen to another
Good afternoon, I have some data that load a datagridview, this data comes from a query in the database in slq, and in that datagrid I have a column with a chekbox, I wanted to know how to do even…
-
0
votes1
answer63
viewsError trying to use Xunit
I’m trying to use XUnit to test my application, but I am getting this error at the time of injeção de dependência. I get the following error: Message: The following constructor Parameters Did not…
-
0
votes1
answer44
viewsHow to connect two Applications in the same instance of Localdb
I have a problem when connecting with the same instance of localDb in another application in the same solution. Detailing the project, I have an ASP . NET MVC5 application in the solution and also…
-
0
votes0
answers382
viewsMessage: The following constructor Parameters Did not have matching fixture data: Icompetitionservice competitionManager
I am getting the following error in my application Xunit, when using dependency injection: Message: The following constructor Parameters Did not have matching fixture data:Icompetitionservice…
-
0
votes0
answers24
viewsGeckofx45 C# Does not work on another computer
I installed Gecko in my visual studio! on my pc it works normally. already tried to send to a friend of mine and to my virtual pc more does not work from the print error. Both had dependencies of .…
-
0
votes1
answer167
viewsError passing information from a datagrid line of a form to the datagrid of another form
I have a following error when passing information of the selected line from a Form1 grid to the form2 grid Follow the code of the Form1 grid private void button1_Click(object sender, EventArgs e) {…
-
0
votes0
answers97
views"ROOT ELEMENT IS MISSING" ERROR WHEN TRYING TO DESIRIALIZE XML IN XAMARIN FORMS
public T Exportar<T>(T obj, string nomeArquivo) { try { string file = Global.LocalPasta + nomeArquivo + ".xml"; if (File.Exists(file)) File.Delete(file); using (var stream = new…
-
0
votes0
answers142
viewsHow to return to previous View without losing data
I have a problem that I can’t solve, which is this. I have a screen that loads two simulated (each simulated has the questions and the radios Buttons that are the options). The simulated ones are…
-
0
votes0
answers218
viewsError while locating Xpath
Good afternoon, I’m having difficulty to solve this problem with Selenium, in which the code is running the automation perfectly and when it arrives at a certain element of the page that does not…
-
0
votes0
answers65
viewsMethod is not recognized within select
The query works perfectly, but when I include the Getqtdecpossible method that returns an integer, to get the possible amount and not need to make other error queries. What I do wrong? var fpcpAdd =…
-
0
votes1
answer27
viewsData update issues with Entity Framework with relational data
I have a Query table that has two foreign keys (Client and Procedure). to add a new query I can normally, but when editing it does not change my Client or Procedure the other fields modifies…
-
0
votes2
answers98
viewsLayout ratio difference between Form1.Cs[Design] and . exe
Recently I’m programming a Windowsforms application using c#, and there’s kind of a bug going on with the IDE that leaves the layout ratio different, like in the image below: The form on the left…
-
0
votes2
answers80
viewsProgress bar does not update with ftp download
Hello, so here’s the thing i have a function that downloads the desired file from http, and as it downloads, it updates the progress bar (being increased from 0% little to 100% when finished).…
-
0
votes1
answer35
viewsDo not insert duplicate value in gridview
I have a Javascript function that I can insert and delete an item in Gridview, but I have faced a problem by not letting an equal value be inserted, as I cannot enter an equal value dsEspecialidade…
-
0
votes1
answer141
viewsI cannot create a Windows Form using the . net core
I’m migrating my project from . net Framework pro. net core. I installed Visual Studio Community 2019 and packages from . net core (including . net core 3.0). But I cannot create a windows form with…
-
0
votes0
answers634
viewsUnassigned local variable C#
Hello, I am at the beginning of my programming learning and I am having problems with this error "use of unassigned local variable" in the code below presents this error related to variable…
-
0
votes0
answers1629
viewsCreate installer in Visual Studio 2019
I created an installer for my solution in Visual Studio 2019 using the Setup Wizard (component of VS itself), and configured it so it was to my liking, I changed the debug application for release…
-
0
votes1
answer39
viewsRewrite Data from an Object List in HTML
Hello, I have a List of objects that is being created in an Onget method and I need to get all the data from it to put in my html page, as I can recover this data? List<string> MenuPrincipal =…
-
0
votes0
answers453
viewsInvalidcastexception: Unable to cast Object of type 'System.Int32' to type 'System.Int64
I’m starting with Entity following this tutorial. My method is giving error in function at the time of Savechanges(); My Controller: [Route("api/[controller]")] [ApiController] public class…
-
0
votes1
answer38
viewsDo Excel formulas continue to work after being imported into a Datagridview?
I have a spreadsheet in Excel where I import it, to present the data in a DataGridView, i wonder if the formulas that are contained in the spreadsheet still work in the DataGridView. To be more…
-
0
votes1
answer43
viewsPick up time from the nearest array to the current time
I have the following Json: { "cod": "200", "message": 0.0055, "cnt": 40, "list": [ { "dt": 1560319200, "main": { "temp": 15.15, "temp_min": 14.49, "temp_max": 15.15, "pressure": 1021.11,…
-
0
votes1
answer1013
viewsSqlexception: The INSERT statement conflicted with the FOREIGN KEY constraint
I have a 1-n employee relationship. I used the Entity Migrations to create the tables based on my models. I checked in the database and the tables were created with their respective PK and FK.…
-
0
votes2
answers48
viewsI need to select the last id of a Viewdata
I have a ViewData with my production orders. I’m making a app where an operator can create a new production from the selected production order, but the ideal was that he did not need to…
-
0
votes1
answer92
viewsViewbag Life Cycle in C# MVC
I know the life cycle of ViewBag of C# MVC, is by request. Doubt If I set one ViewBag with the same name in several controllers, there is the possibility of the set information being read /…
-
0
votes1
answer30
viewsWrong value return
I am creating a list within another one as follows: var playerGames01 = new ObjectGamePlayerMoviments(); playerGames01.Game = new List<Games>() { new Games { PlayerMoviment = new…
-
0
votes1
answer58
viewsViewbag error: does not contain a definition for field name
I got this Viewbag ViewBag.LogAlteracao = _logAlteracaoRepository.Table.Where(log => log.OrderId == id).ToList(); That is the domain public class LogAlteracao : EntityBase { public DateTime? Data…
-
0
votes1
answer484
viewsHow to resolve lambda expression conversion error of type Servicelifetime net core?
I am starting a very simple project with net core 2.2 and confronted myself with the following error: Cannot convert lambda expression to "Servicelifetime" type because it is not a delegated type…