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
answer35
viewsSystem.Indexoutofrangeexception: Index outside matrix boundaries
Good morning! I am working on a project for my PAP, and for a company and I cannot understand what this mistake is, I have already researched in several places but still do not understand, I need to…
c#asked 3 years, 7 months ago Pedro Tavares 9 -
0
votes0
answers17
viewsHow to move a line drawn in Winforms?
I know how to draw lines in a program, but I wish the user could "move that line" that he did (like a vector) to somewhere on the screen. It turns out I didn’t find anything about it at Microsoft,…
-
0
votes0
answers29
viewsProblem with clicking a Textbox inside a Child Form
Good Afternoon! I have the following code in my application: using System; using System.Drawing; using System.Windows.Forms; namespace WindowsFormsApp1 { static class Program { [STAThread] static…
-
0
votes0
answers23
viewsRename Dll output C# Projetoform VB-2019
What I want is to rename the dll without losing the reference . Example : System.Threading.Tasks.Extensions.dll for TRANSPCONSUMIR.System.Threading.Tasks.Extensions.dll But when I just rename, he…
-
0
votes2
answers44
viewsRun method in Form1 for form2 change
I’m developing an inventory manager, and the data is being stored in a database. The problem I’m facing is this: when I add a new product for example, I created a "Update list" button (I left it in…
-
0
votes0
answers31
viewsDevexpress - How to change the name of the button dynamically inside Datagridview
Please, I need some help, I’m new in development c# widowsform. I have a Datagridview that pushes some buttons for each line, I can’t program so that the name of the button "Button.Caption" changes…
-
0
votes1
answer40
viewsSending File to API with Authorization . Net 5
On my system, I need to send a received form file to an API that will be saved in Azure. For this submission I need to pass a Bearer Token, the part of the token I was able to do and receive,…
-
0
votes1
answer31
viewsHow to spin a Gameobjet without spinning his son?
I wanted to know a way to rotate the object without turning the canvas inside it. My Spinning code is like this: void FixedUpdate(){ if(facingRight == false && moveInput > 0) { Flip(); }…
-
0
votes2
answers66
viewsHow to get specific text from a txt file in C#?
I’m a layman, still taking the first steps in programming and C# and I’m having trouble solving a problem. I would like to search a specific information in a txt file with the following lines: Nodal…
-
0
votes0
answers8
viewsPage.Loadcontrol does not load the controls
I am using the Page.Loadcontrol() method to initialize an instance of a control by sending a parameter in the constructor. The instance is created, but the controls present in the file . ascx are…
-
0
votes0
answers23
viewsThe button click event fires Modalpopupextender but does not turn off
MODAL appears, but NO longer wants to leave! How do I fix this? I have a code in ASP.Net, . Net Framework 4 with Visual Studio 2010. <asp:button ID="hButton1" runat="server"…
-
0
votes0
answers15
viewsShow document . PDF in browser via Azure Function
Azure Function then takes the document ". pdf" and download it, what I want to know is a way to grab that document, save it in the browser and display it on a web page I wonder if I should return…
-
0
votes0
answers19
viewsHow I monitor the sensors of a C#printer
I have a hybrid printer authentication and printing quite old by the way, what happens is that in the authentication part has a sensor that the document is present, what I would like to know is how…
-
0
votes1
answer38
viewsRepeated hunch
Hey, here’s my problem. I’m developing an application in c# (console) to learn c# and I’m having a problem that I can’t solve. First I draw the numbers that will be drawn: Random rnd = new Random();…
-
0
votes1
answer28
viewsCalling the SQL variable for the program C#
I have to create a c# function that will call the variable I created in sql-server but I can’t figure out how to do it! C# code: var ss = new SqlConnection("Data…
-
0
votes2
answers43
viewsHow to deserialize JSON Array in an Object Array?
I’ve been trying for a while to deserialize a JSON return from my nodejs api. I’ve tried many ways and no success. I have the following client request return JSON. "response": { "count": 1,…
-
0
votes1
answer83
viewsWould this class relationship be correct?
I am currently studying about classes, more specifically class/UML relationship and I am doing it in C#. I would like to know if this code I wrote below is the most suitable or if there is a…
-
0
votes0
answers22
viewsThe "Bitmap" type is defined in an Assembly that is not referenced C#
The problem: I’m doing a project using Windows Form C# which should basically record a video from a webcam and save to the computer. I was using the Aforge.net package to record the video and when I…
-
0
votes1
answer44
viewsI cannot connect to Database in Entity Framework
Good night, I am unable to connect to the database to create the Models folder tables in .NET. When I try to make the Migrations returns this error: "Could not run because the specified command or…
-
0
votes1
answer32
viewsError using Accord.Net package
I’m making a Windows Forms C# application and using . Netframework 5.0 to record and save videos to the computer with a webcam. I use the Accord.Net package for recording. It was almost ready with…
-
0
votes1
answer39
viewsHow to download a Github release file using Webclient on . NET 3.5?
After my question of Create Zip files and unzip using . NET 3.5 I have a problem. It’s just that before I was able to download my file in a Github release, but then it didn’t work anymore. using…
-
0
votes1
answer35
viewsHow to change the Listbox Index to 1?
Citation I would like to add names to a listbox, put a NumericUpDown to associate how many dependent names will be added at most, depending on the number the user enters, and a txtbox to add names…
-
0
votes0
answers20
viewsReceive a number through a Stored Process c#
I have an object that has properties of various types and one of them is a List <int? >, however when executing a precedent it returns me only one number, does it work if I remove the list and…
-
0
votes1
answer23
viewsIdentical objects with same value fields returning different C#
Identical objects with equal fields returning different when comparing with Equals or == var oldPayments = orderNotTrack.Payments .Where(p => p.Status == Status.Activated) .Select(p => new…
-
0
votes0
answers13
viewsMultiple sorting in Datatable with Serverside
Greetings. I have a table generated with the help of the Plugin Jquery Datatable with the ServerSide enabled and running a Script from the server side ASP.NET. Only that I need this table to be…
-
0
votes1
answer21
viewsHide form after uploading a file
Hello, I have a view that has more than one form and in each form, I specify the type of document that will be uploaded. ex: Form1 has an Hidden input with value = 1, for Cpf... form2 value = 2, for…
-
0
votes1
answer151
viewsC# - Read txt file and return value in textbox
I am making an application that from a selection of Combobox, it reads the txt file (containing two columns) and returns me the value of the same row but column 1 (column 2 would be the value of…
-
0
votes1
answer36
viewsMega API Client: Cancellationtoken at Downloadfileasync
I started using a MEGA file cloud API where I can upload and download the files from the cloud. Nuget Package here, I’m doing fine: using CG.Web.MegaApiClient; using System; using…
-
0
votes0
answers18
viewsUsing a domain class as input model is bad?
my first question here. Well my question is more related to code design. Let’s say you developed a c# Rest API using . net core and you have in your domain a class called Pessoa and you have a…
-
0
votes0
answers41
views -
0
votes1
answer46
viewsMap a property to Enum
I’m starting automapper studies so I don’t even know if I’m using the correct terms to ask the question, but here’s the thing. I have the class Patient that, among other properties, has an Enum…
-
0
votes0
answers27
viewsConversion error in Where clause when filtering records using EF Core 2.0
I’m getting a list of records and filtering according to the given parameter. The problem is that an error is appearing in which I do not know (as picture). There are two classes : Personal Document…
-
0
votes1
answer27
viewsError sending Controller object to View
I am creating a small project in Asp.net MVC 5 to train and I am having problems passing a Controller object to the View, is showing some error related to the Where<> method of the LINQ…
-
0
votes1
answer41
viewsHow to filter a List record within another list c#
I have a class of App where in that class contains a ICollection<Comentarios> Now I need to filter ALL comments who have Status == Aprovado, where this Status is an Enum. I tried to do it this…
-
0
votes1
answer49
viewsProblem with installation of offline prerequisites - Visual Studio C#
I’m trying to create an installer for my Windows Forms C# application that should download its prerequisites from the same location of the application, ie, install offline the prerequisites. In…
-
0
votes0
answers8
viewsTransform Image into Map to use with Pathfinder Algorithm
I want to develop a kind of AI that will go a shorter way (Walkable part is just where it is gray) on the map and for that I will use the Pathfinder algorithm. For this I am using the following…
-
0
votes1
answer21
viewsConsumer Rabbitmq is not working
I created a simple program of registration and orders with customers and products. My goal was to implement a CQRS application so that when adding a new order a message would be posted on Rabbit and…
-
0
votes0
answers25
viewsHow to use a C# DLL in C++ using COM
In my project I am developing interoperability between C# and C++ in a single Library. In C++ my C++ functions and functions could bring to C# while C# methods could bring to C++, for example…
-
0
votes0
answers19
viewswrite data from a Datagridview to the database
Good morning, I am making an application similar to a sale, which contains sales and sales items. my problem is that I am not able to save the items of sale that is in datagridView, I am using…
-
0
votes0
answers29
views@Html.Pagedlistpager No Bootstrap
I am building a small project in Asp.net MVC and I need to make use of the X.Pagedlist library, I was able to make the pagination all right, but it is not applying the Bootstrap, which should be…
-
0
votes1
answer25
viewsC# Entityframework - How to clear FK field?
I need help with an entity update operation by Entityframework I want to clear a relationship between two entities. Imagine an example scenario below, I have an "Agent" entity for general use, and…
-
0
votes1
answer23
viewsError using an incremental variable with Closedxml and C#
I am using a while to read data from a spreadsheet and store in a list. When executing the code I get the following error: Unable to cast object of type 'System.String' to type 'System.Double'.…
-
0
votes0
answers17
viewsI would like to know how to generate a digital certificate request
Below is the code I tried, but as I never did, it is not working. var subjectName = CN; // Create new Object for Issuer and Subject var issuer = new X509Name(subjectName); var subject = new…
c#asked 3 years, 4 months ago Leonardo Bilha Terragno 1 -
0
votes1
answer21
viewsI need to list Database data, each in a component, if any. in C# . NET Visual Studio
In C#, visual Studio. hello I am new and come for help, I would like to display in a component, can be in the textbox, Panel or label the data of table 'OCCUPATIONS'. I’ll try to explain: I have a…
c#asked 3 years, 4 months ago Alex Rodrigues 19 -
0
votes0
answers19
viewsIs the Web API more efficient than Web Methods to access data in a C#application?
Today on the C# Dotnet you can access a C# function on your ASPX page by javascript, without needing Jquery. As long as the function is Static and dependent on system.web.service.webmethod on an…
-
0
votes1
answer54
viewsRequest Restsharp
Good night people. I’m new to the C# world and I’m having the following problem using a C# code that makes an authentication request using Restsharp. This code was generated/exported from a request…
-
0
votes0
answers23
viewsAdd HTTP response header (Access Control Allow Origin)
In my ASP.NET CORE MVC application I have the dist folder in wwwroot: According to the documentation Static Files in ASP.NET CORE configured the startup class by adding an http response header:…
-
0
votes1
answer15
viewsViewbag resetting when returning page on Razor Page
On the Onget of the page I load the Viewbag so: public IActionResult OnGet() { ViewData["SGP_GRP_IdGrupoProduto"] = new SelectList(grupoProdutoService.GetAll(), "GRP_Codigo", "GRP_Descricao");…
-
0
votes0
answers20
viewsHow to write an . xlsx file permanently, using the Closedxml library?
When you run the code for simulation, you notice that it is changing the file test.xlsx as expected, however, when closing the execution it does not save the changes as, when running the program…
-
0
votes0
answers15
viewsValidation of Google User Token in the back end
I’m facing a problem and I’ve already lost hours on forums and on google certification, but I can’t find the solution. I have the following scenario: A front-end that is from a third company logs in…