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
answers72
viewsProblem with serial reading
Guys, I’m trying to read data from a serial port in c#, but along with the data is being returned too "junk", which makes it impossible to convert the string to integer. Is there any way to make me…
-
0
votes1
answer77
viewsGet a file name and display on a label
I am doing a project and need that when opening an (image) it will take the name of this image, save in a variable and show in one of the excel line. Note: This will be repeated, there will be…
c#asked 5 years, 10 months ago Pedro Duca 302 -
0
votes0
answers14
viewsInvalidoperationexception: Unable to resolve service for type while attempting to Activate
This is probably a duplicate question, but all the questions I saw didn’t solve the problem. The mistake happening is: The flow is as follows: View -> Controller -> Service -> Repository…
c# entity-framework asp.net-core entity-framework-coreasked 5 years, 10 months ago Thiago Cunha 1,356 -
0
votes1
answer87
viewsError: Undefined object reference for an object instance of an Object.System.Formatexception
I’m having a problem when it comes to excluding a client. In the bank is deleted, but instead the message appears: "SUCCESSFULLY EXCLUDED!", message appears: "Could not delete". Details: Undefined…
-
0
votes2
answers130
viewsI have Error in viewModel ASP.NET MVC C#
What I looked for, we used viewmodel to then access in the view several models, my problem is that I have an error that does not allow me to access the Model. And everywhere I look, I can’t figure…
-
0
votes1
answer17
viewsReportviewer deleting data from Access database
I recently added Reportviewer to my Visual Studio 2015 Community for creating and printing reports. My database already contained information, added before adding Reportviewer. I am currently 4…
-
0
votes0
answers458
viewsError deserializing JSON (JSON array)
I looked for other topics related to this error, but I believe my case is a little different. Error: System.Exception: Error processing request: Cannot deserialize the Current JSON array (e.g.…
-
0
votes0
answers462
viewsConsuming C# Web Api with Reactjs
I am trying to consume a Webapi created in C# webApi2 in an application created in reactJs, when I request the Api using the browser or Postman I have the information returned, but when I try to do…
-
0
votes0
answers254
viewsError index was Outside-the Bounds of the array
I am trying to run my application, however, every time I click the record button the screen returns me this error! I’ve tried everything and I still can’t, what can it be? public void…
c#asked 5 years, 9 months ago Lucas Tadeu 71 -
0
votes1
answer139
viewsUnit tests with Nunit in function with Jsonresult type return
I’m trying to do unit testing in the following function (there are more ifs, but I believe this is enough to illustrate), using Nunit. The problem is that I am unable to treat the return of the…
-
0
votes2
answers158
viewsIncorrect formatting of string to decimal during Excel import
I am making an excel import for a dataGridView and the formatting of the field type Value does not bring the comma, period and decimal place, example: In the Excel it’s like this: 995.800,00…
-
0
votes1
answer77
viewsI cannot change the center of rotation of a Tilemap (Unity + C#)
I’m developing a 2D game using the Unity 2018.3.02. I’m using Tilemap for the construction of the phase, but this Tilemap will rotate. The Tiles in Tilemap form a square, that is, the filled Tiles…
-
0
votes1
answer98
viewsWeb Scraping or Web Crawler isolate Node
Please, I’m trying to retrieve the following information: "value bra": (<span class="value bra">3,666</span>) <div class="ticker-financial-market" initiated="true"> <div…
-
0
votes1
answer35
viewsCut an image and display the two parts that have been cut
I’m starting in the programming and I came up with a question. I’m trying to cut an image in half and show in two picture box the two cuts. I’m making the cut like this. private void…
c#asked 5 years, 9 months ago Pedro Duca 302 -
0
votes1
answer188
viewsSite MVC C# displays the message "401 - Unauthorized: Access is denied due to invalid credentials." after logging into external access
I created the normal MVC C# site without any peculiarity. In the Default Controller the index was this way. [AllowAnonymous] public ActionResult Index() { return View(); } [HttpPost]…
-
0
votes0
answers36
viewsError returning API when running in parallel - C#
Hello, I’m having doubts as to which solution I could apply to the following problem: I built an API that when called makes several calls in some databases and after composing and concatenating the…
-
0
votes1
answer36
viewsTabs - Return to desired tab
Good morning, you guys! In my Suppliers register, in View Details, I have a Tab with the tabs: Data, Contacts and Purchases, and when I click on the Contacts tab, there is a button to register a new…
-
0
votes2
answers573
viewsDoubt how to send calling a method in another class
I have a cl_Calculo class that has a method that calls a table in sql by a CRUD class already created, and I want in a Form when clicking a button to call the method of this class passing the sql…
-
0
votes2
answers88
viewsI want to leave a string with Zero value
I have a small problem, I have a textbox that has a value in real "999.99" and writes a number in full, only that the textbox often receives an incomplete value like '23' etc., I want when the…
c#asked 5 years, 9 months ago Marcos Eduardo 29 -
0
votes1
answer262
viewsReinf - Event Consultation 2099 -closing
I’m performing the R2099 Closing Event query, based on the question: Reinf - Event error R-5011 Using the same way @Pedro Gaspar demonstrated: var urlServicoConsulta =…
-
0
votes1
answer307
viewsInsert Array into JSON
I have a question, I want to insert a list within a field JSON. How do I make the strings that are in the list cities become part of the city options for the state Gurajat? The code is like this:…
-
0
votes2
answers192
viewsSeparate COM object from adjacent RCW
In this Try-catch occurs the following error message: The code: try { dbConnection.Open(); cmdQry.CommandText = "SELECT * FROM tbl_ItensEmbaOrdem WHERE idOrdem=?"; cmdQry.Parameters.Clear();…
-
0
votes1
answer191
viewsHow to make the Login page become a standard route for an Asp.Net Core 2.2 application
The Login page is within the following folders Area - Identity - Pages - Account. How to make the Login Page become a standard route, this is when the user accesses the Asp.Net Core 2.2 application…
-
0
votes0
answers46
viewsFind Javascript Function (onchange)
I have a question. I want to make a selections box depends on a page using Razor and javascript. TYPE, when selecting the community, the people corresponding to it have to appear. But I can’t call…
-
0
votes1
answer101
viewsBind problem in C# WPF
I have a WPF that is as follows: <ComboBox Name="comboBoxRemetente" VerticalContentAlignment="Center" Margin="5" Grid.ColumnSpan="20" ItemsSource ="{Binding Path=Lista, Mode = TwoWay}"…
-
0
votes0
answers124
viewsGet numerical values from the database with comma and dots [FIREBIRD + C#]
Hello, everyone. I’m having trouble retrieving the numerical values from the database in my Datagridview already formatted (including commas and dots). The code that gets the data through a process…
-
0
votes1
answer48
viewsProblem when trying to save data to the observation field
I have a problem when I will enter record in the Notes field. When the user writes a note and then right after click save the same is not registered. Customer Class: --> The Method I am using to…
-
0
votes1
answer64
viewsHow to delegate UI methods automatically
I created these methods in the interface: public interface IEvents { void OnEscrever(string text); void OnEnable(bool b); void OnDisable(bool b); } I’ll have some classes that will inherit these…
-
0
votes1
answer238
viewsProblem with Onkeypress and Onenterkey
I have a problem, I need to get the value typed in a field, I thought to use OnKeyPress calling the function key_press as follows: var str; var keycode; function key_press(e) { var event = e.event,…
-
0
votes1
answer265
viewsProblem with punctuation and space when running CMD via C#
I have a program in C# that uses a button to execute a command on the CMD. This command is used to take a database on a server and put it on the machine in a path you choose(Mysqldump). private void…
-
0
votes1
answer830
viewsError Mapping types. Mapping types: Icollection`1 -> List`1
I’m having a problem converting a List for ViewModel, using the ToListViewModel. Faturacontroller.Cs FaturaViewModel faturaViewModel = new FaturaViewModel(); faturaViewModel.mensagens = new…
-
0
votes2
answers669
viewsInvalid character in HTTP Request C#
I need to develop a Webapi that you pass a Query and it returns the google search with title and url. I am using C# and . NET, when I do the HTTP request to receive page data, it is returning the…
-
0
votes2
answers158
viewsHow do I always return the same View, independent of Controller and Action?
I created a View calling for Manutencao that displays a maintenance page. And whenever the Index is called I display it. public class HomeController : Controller { public ActionResult Index() {…
-
0
votes1
answer33
viewsIs it possible to put the translation files in folders to get more organized?
I would like to put the translation files organized by folders in this way Everything in the root of the folder Resources works but moves into that other folder stops working as I can configure so…
-
0
votes0
answers37
viewsVariable value increases +1 within Thread
I am trying to change the color of the Datagrid line and this is easy. However, something is happening with the variable value idxRow2 when this is accessed in the new Thread. The problem is in the…
-
0
votes1
answer126
viewsHow to convert from List<> to Ilist<> using Automapper?
I need to convert a List to Ilist with automapper knowing that both are in different classes and one of them has a constructor. Is that possible? I’m using the Automapper 6.2.2. public class Pessoa…
-
0
votes1
answer235
viewsWeb Api does not return related data
I’m doing some tests with Web Api (Asp.net core). And with Eager Loading I’m trying to upload a related list, but what I get from Postman is this:…
c# asp.net web-service asp.net-web-api asp.net-coreasked 5 years, 9 months ago Márcio Sebastião 769 -
0
votes1
answer264
viewsProblem connecting with MS SQL Server. Same C# code does not work in Xamarin
We are updating the... I was able to access the bank through Android the problem was the port that was not configured. Now there is another question when I do code Debug for android works but if I…
-
0
votes1
answer185
viewsController receiving null parameters
//Controller [HttpPost] public ActionResult EditarConfSist(ConfSistMOD confSist) { try { var repositorio = new ConfSistREP(); repositorio.EditarConfSist(confSist); // gerar o log logar = new…
-
0
votes1
answer281
viewsError while trying to popular a List
I’m trying to create a table with Union, I made a class to popular on ViewModel, in this way: public class ListVencimentos { public int Id { get; set; } public DateTime Data { get; set; } public…
-
0
votes0
answers46
viewsWeb Api - Is it wrong to get a related object like this?
I started developing with Web Api (Asp.net Core) and I have a doubt about this right or wrong what I am doing... I have two classes in 1 to N: The Department class: public class Department { public…
c# web-service asp.net-web-api asp.net-core asp.net-core-web-apiasked 5 years, 9 months ago Márcio Sebastião 769 -
0
votes0
answers58
viewsDifferent report and program C#/Winforms
I have an app where I have to do a drying program for a greenhouse, where I measure and humidities of a wood, I program it and send it to the machine and so on, but when I see the report of such…
-
0
votes2
answers68
viewsHow to take what was returned from a Task
I have following code: List<UserItem> items = null; Task taskCreateItems = new Task(() => items = DeliverItems(Session, Item.GetBaseItem(i), (priceAmount * ((Item.Items.Count > 1) ?…
-
0
votes1
answer38
viewsMouse move over an item and an event be generated WPF
I’m having difficulty implementing an effect where when I hover over the item on the screen the speed should be 0. And without the mouse above should be back to 30. Use WPF using MVVM structure, so…
-
0
votes1
answer111
viewsPick Line Index clicked with the right button, remove the option to select in datagridview
First of all thank you for your time. I have a question: I have a Datagridview dgvPessoa filled with a Datatable. Example: I want you to select when right-click and not left-click, and pick the…
c#asked 5 years, 9 months ago Gustavo Pedro 201 -
0
votes2
answers65
viewsHow to do a parallelism or asynchronous call in a lambda
I have this query qry.ForEach(q => { var product = new Product(); product.CategoryId = q.CategoryId; product.AuthorizeMaximumPercentageAlteration = q.AuthorizeMaximumPercentageAlteration;…
-
0
votes1
answer328
viewsHow to return the last Record of an SQL column in a textbox?
I am developing an application for my technical course that will register customers, in case I would like that before registering the client the field code returned the last code of the table sql +…
-
0
votes0
answers38
viewsWhich version of Visual Studio to use?
Hello, I have a problem related to which version of Visual Studio to use. The scenario is this, the company I work for has nothing to do with software development, but I’m a programmer and we…
-
0
votes0
answers35
viewsOnetomany entering a new record?
I am trying to create a Onetomany relationship between 2 classes "User and Broker" where 1 User has many Brokers. The problem is when I add a new Broker a new User is created and I don’t know why it…
-
0
votes2
answers203
viewsHow to Split a List Proportionately 32%, 32% and 36%
I own a lista("arquivo txt") with about 150 values with three types of flowers "Iris-setosa", "Iris-versicolor", "Iris-virginica" I need to read this file, check the amount of each flower in that…