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
answers22
viewsc# webbrowser Clicking a button using the onclick attribute. getattribute("onclick") does not work
Hi, I’m wanting to click on a button that has the following html: <a href="javascript:;" onclick="ExecutarLance('46368');" title="ExecutarLance" class="btn btn-custom3">LANCE</a> == $0…
-
0
votes1
answer81
viewsHow to read a file and save each line at a position of a vector in C#
I’m learning how to use C# in Visual Studio 2019. I want to read a text file and save each line in a position of a vector of the type string. However, when I click on "button1" to read the file and…
-
0
votes0
answers10
viewsReal-time Oxyplot Graph Problem - Xamarin Forms
I generated a graph on the Oxyplot component in my Xamarin Forms application. I would like to associate the graph drive on the X axis with the other function. Basically, when moving the graph to the…
-
0
votes1
answer85
viewsEncrypt and decrypt
I took this code here to encrypt and decrypt a Id of the type `Guid: public static string EncryptString(string text, string keyString) { var key = Encoding.UTF8.GetBytes(keyString); using (var…
-
0
votes1
answer19
viewsAsp.Net api with xml Iscancellationrequested
I have an api that accepts the post request with json and xml for Pedidocompra, for cases where I receive the xml is occurring an anomalous request cancellation, that is, some enter the api and…
-
0
votes1
answer39
viewsHow to put returned Web Service data into Json (GET) for an array or variable in c#
Hi, I’m calling a web service in Rest, I can access the answer but I wanted to organize the data that is returned (which is in Json), for an array or variables but how can I do it? Thank you in…
-
0
votes0
answers45
viewsCreate dynamic html table by setting the class or id to rescue later with jquery
I’m creating a dynamic table as the user adds content. Then I need to take this data and create the object and send it to the controller, to create the table I used the following way: function…
-
0
votes0
answers35
viewsC# - Cascade Repeat Structure
first good morning! I have a task to feed a "file tree (windows explorer style)" in object format. For this I have initially a method that lists all the files and folders in the directory root of…
-
0
votes1
answer78
viewsIn Clean Architecture, which layer receives the business rules and logic specific to a system?
Speaking of Clean Architecture, we usually see examples of a basic CRUD system, but that do not show where are located the codes of controllers that need a complexity a little more than simply a…
-
0
votes1
answer44
viewsHow to detect "0X0D" car return in a TCP client program?
Hey, fellas, what’s up? First of all I’m sorry if by chance I make a mistake in the forum, because, it’s my first time here and I’m not a professional programmer. Well, I downloaded this program on…
c#asked 3 years, 9 months ago CláudioChip 11 -
0
votes0
answers61
viewsCommunication between micro services
Hello I am developing an architecture in micro services dotnet a software in the retail area (retail, for who is en). I have three micro services: Client, Catalog and Command. Customer: all customer…
-
0
votes1
answer30
viewsTransform each site’s Node into an array element
I want to turn every headline on this site into an element of an array. I’ve tried several ways but none of them work, so if you could help me, I’d be grateful. I am using Htmlagilitypack using…
-
0
votes0
answers28
viewsHow to use the async function of System.timer.Timers?
I’m trying to deploy an asynchronous timer in my application. NET, so that the Forms is interactive while the back end makes a request and deserializes the answer of it, assembling everything in a…
-
0
votes1
answer38
viewsMy JWT+Bearer token always returns me unauthorized (401) C#
I have a system for studies, totally decoupled the front-end of the back-end. I implemented JWT+Bearer, however I log in by the controller and it returns the information with the token: But when I…
-
0
votes1
answer52
viewsWhy can’t I instantiate a class from Linq
I’m trying to instantiate the following class from the English library using System.Reflection; namespace System.Linq.Expressions { // // Summary: // Represents accessing a field or property. public…
-
0
votes1
answer36
viewshow to use DATA_FORMAT() in mysql with C# Asp.net?
I need to take the data of the dates and pass them to the format dd/mm/AAAA, because it comes from Mysql AAAA-mm-dd to then move to a databinder that is in a Repeater on the front, someone knows how…
-
0
votes0
answers21
viewsWhat reference is missing for my Form fields to be filled with Datagridview information?
I created a separate project to find out why information from any row in my table is not sent to the fields in my frmVisualizar_Cadastro. I discovered the error and now when I click on any row of my…
-
0
votes1
answer63
viewsC# - Datagridview error occurs when column cell is empty
I kindly ask that an experienced programmer help me resolve this error! In the presented code has a sum calculation, the problem occurs when I leave one of the cells in the dgviewPersonalized column…
c#asked 3 years, 9 months ago Marcio Valerio 5 -
0
votes2
answers214
viewsHow to calculate average students and show in percentage?
I’m trying to create an algorithm in C# as it is in the exercises, in the visual studio, to calculate various average students and show students above average in percentage,I tried a code but this…
-
0
votes0
answers24
viewsJson deserialize array for object
I’m trying to call a web API that returns me a json with multiple values as specified below json received [ { "total_documents": 2, "total_in_this_page": 2, "current_page": 1, "total_pages": 1 }, {…
-
0
votes0
answers26
viewsWebhooks association
Hello, I have a code that integrates Jira and Discord from a webhook. It works correctly, however I would like to add more than one webhook. But I’m not quite sure how to do this. using System;…
-
0
votes1
answer71
viewsModal bootstrap opening a redirect page that should not be inside it
Inside the controller of my partial View that are opened in modal I make a validation if the token is valid, in case everything happens well it will open and show the content, and this happens…
-
0
votes0
answers25
viewsView class detail
Good afternoon, I need to display the details of a certain class by clicking on a button, passing only the code. In the Index code, I did basically this way: <button type="button" class="btn…
-
0
votes0
answers25
viewsWhat is the correct way to model a Client class that can be PF or PJ?
I’m trying to model a Client class and the way I did I don’t know if it would be right, because I don’t know how to create the client class that can be both PF and PJ, follows below the modeling of…
c#asked 3 years, 9 months ago Gabriel Lemos Alves 1 -
0
votes0
answers47
viewsRemove seat seats on the database side with Asp.net core Entity Framework
I have a method that I receive a string, does the search and returns all the data that is equal to the word I passed, like this: public async Task<List<ProductDto>> GetAllAsync(string…
-
0
votes0
answers23
viewsReport Viewer returns #Error
I am developing a report that should return a table whose data comes from a class, where this class has List type property. The problem is that when I report it appears #Error in column data. The…
-
0
votes2
answers44
viewsDownload Async Task C#
Hello I have the following situation with that function. And this giving this rejection Webclient' does not contain a definition for "Downloaddatataskasync" and it was not possible to find any…
c#asked 3 years, 8 months ago Cristiano Rogoy 27 -
0
votes0
answers43
viewsError "Unable to resolve Ilogger from Microsoft.Extensions.Logging" when making a request to endpoint from Azure fucntion
I have an Azure Function that has an endpoint that questions a data repository and to have Traces of what the function does I used the ILogger<T>. The class in question has the implementation…
-
0
votes0
answers42
viewsEntity Framework: How to perform the Insert of a table with relation 1.. n without the children also being inserted?
I am using Dotnet Core 3.1 with EF Core. I have three classes in my context: public class Sale { public Sale() { this.Cars = new List<Car>(); this.CarSeller = new Seller(); } [Key] public int…
-
0
votes0
answers26
viewsReceiving data from Arduino to the textbox in c#
I’m developing a design using Arduino Nano with Microsoft Visual Studio using the C#language. My goal is to turn on and erase the Arduino LED by MVS and tb read a message sent by the Arduino serial…
-
0
votes0
answers39
viewsC# inserts incomplete text into the database
Hello, I have an application in . Net C# that updates/inserts a text in HTML format in the Mysql database. In my table in the database I have a field of type Longblob that will store this text. But…
-
0
votes1
answer36
viewsProblems using "using" to access static methods
I created in C# a static class with the methods Decode() and Encode() as in the code below: namespace Crypt { public static class CaesarCipher { public static string Decode(string text, byte key) {…
-
0
votes1
answer29
viewsSWIG - How to convert primitive types that are passed by reference?
I’m using SWIG to be able to use a C++ code in C# (Ogre3d for the curious) I have the following method in C++: bool suggestTangentVectorBuildParams(VertexElementSemantic targetSemantic, unsigned…
-
0
votes0
answers26
viewsHow to capture and compare a tag content, using Xpath, for automation using Selenium c#?
I would like to know how I can take the content of a tag, for an Xpath, and filter it, for example: I have the following code below, it basically goes to a website, and finds a table, and within…
-
0
votes1
answer45
viewslimit an SQL table to a single record and not let the c# application insert more records into that table
Good Afternoon I’m new to this c# and SQL but I made an application in c# and I have a Company table that I want to limit to a single record ( a single company) and I want the user to change or…
-
0
votes0
answers19
viewsError: CTC1014 Docker command failed with exit code 1
I don’t have much experience with Docker and programming, but when trying to run my project. net core with Docker it tries to compile, but after a while it returns the error below: Erro CTC1014 O…
-
0
votes0
answers36
viewsProblem with RPS Signature and Batch (NFS-e)
I’m trying to sign the data block of the Gerarnfse method. It is necessary to sign the RPS and the batch. However, when sending, I always get the invalid signature message. Follow the code I’m…
-
0
votes0
answers19
viewsI need to create a program in c that analyzes whether two passwords typed match
Statement of the financial year: Write a program to verify a password entered by the user. Ask the user to enter a password and then he must write it in another field. Compare the entered values and…
-
0
votes1
answer79
viewsHow to consume Github API on VS2019 avoiding 403 error on all requests?
Somebody please save me. I need to consume the Github API for an internship challenge, but I’m caught in a 2-day problem, the challenge makes it clear that it’s not to use authentications, just use…
-
0
votes0
answers43
viewsI Can’t Create Bitmapimage "interface that was marshalled for a Different thread"
Error: System.Exception: 'The application called an interface that was marshalled for a Different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))' I’m trying to get a BitmapImage…
-
0
votes0
answers47
viewsError calling endpoint: Exception has occurred: CLR/System.Nullreferenceexception C#
Guys, I’m trying to generate a spreadsheet filled with the data I have from SQL server, I can get that information right but when I call a method responsible for taking that information and…
-
0
votes1
answer33
viewsEF: How to return only a few columns from the database?
I’m having trouble returning a collection of objects from the database with just a few columns selected. I searched several solutions on the web and the vast majority presented the solution below,…
-
0
votes0
answers10
viewshow to close the current form while handling an external component?
I have a form that is not the main form of the program. I am using Libvlc for C# for media playback in this form, so I have a Mediaplayer component. I’m dealing with the Mediaplayer_stopped event as…
-
0
votes0
answers15
viewsError Input string was not in a correct format. C#
follows below my code `if (actualValue != "") { capacityimportData = new Capacityimport(); capacityimportData.Quantity = Convert.ToInt16(actualValue); var data = ""; if…
c#asked 3 years, 7 months ago Watson Rocha 1 -
0
votes1
answer30
viewsApplying Runtime Migrations . Net Core
The question is exactly as in the title of this topic, but all the help I found related to the subject is running the code on the application startup requiring arguments to be passed to the host. I…
-
0
votes0
answers15
viewsC# Razor pages - how do I use the @{_Layout.cshtml} website correctly on more than one page?
Opá personal, good afternoon! I’m starting a Razor Pages MVC project in Visual Studio, but I’m having a problem where I can’t index more than one page to the main layout @page @{ Layout = "…
-
0
votes1
answer46
viewsSQL : Insert if Not Exist
Doubt: I made a form in C# connecting to the bank I wanted to know how I can include in this query the if not exits @param1 In order to avoid duplication. Link to the Reference Code: Mysql: Insert…
-
0
votes1
answer34
viewsHelp - Modify formula when changing radiobutton
Hello, developers! I need help with my MRU calculation program. When I input the data with the meter/seconds radio button active, and then select on the km/h radio button it converts the data…
-
0
votes2
answers83
viewsError "Nullreferenceexception: Object Reference not set to an instance of an Object" in Unity
I’m trying to develop my first game with Unity, a Space Invaders, and I was able to do a lot of things, but when I get to the part of the code to create the enemy’s movement, I’m getting this…
-
0
votes1
answer84
viewsHow to extract CNPJ from A1 . pfx or . P12 Digital Certificate on Linux and Windows using . NET Core?
I’m developing a system where we register companies by digital certificate, where the user uploads the file, puts the password and imports. I need to extract the CNPJ that is within the certificate…