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
answers36
viewsSignalr Error: The connectionid is in the incorrect format
I have a web application that uses Signalr to display server notifications whenever a report is sent. Recently I have received the error below, but searching the internet did not find out what can…
-
0
votes0
answers32
views: 'The input string was not in a correct format. '
Hello, I am developing a program that collects data entered by the console in c#, however, I come across this problem when I enter a value other than’s' here char entry = (char)Console.Read();…
-
0
votes1
answer30
viewsHow to sort a list of objects through a custom criterion (no order by)?
I ask for your help in solving a problem that’s been bothering me. I have a list of scales and would like to sort it through the Status(which in turn is a property of Horarioescala entity, but the…
c#asked 4 years, 1 month ago wrafanunes 21 -
0
votes0
answers160
viewsHow to Generate Qrcoder Image on screen using C# . NET Aspx with Qrcoder library
Metodo utilizando a biblioteca QRCoder. using QRCoder. public class GerarQRCoder { public static void GerarQR(TextBox txtQRCode) { string Cd = txtQRCode.Text.ToString(); QRCodeGenerator qrGenerator…
-
0
votes1
answer171
viewsConsuming API with Refit C#
Good guys, I’m having a little problem consuming an API. I am with an Aspnetmvc web application and need to consume an API. First with a user selection I run this method below in the controller:…
-
0
votes1
answer95
viewsHow to add an icon inside a Textbox using Material Design?
I installed the Material Design Xaml package in my project, but I have a question of how to create an icon in Textbox. I have the following code: <StackPanel> <TextBox…
-
0
votes1
answer822
viewsHow to resolve error C# "Nullreferenceexception: Object Reference not set to an instance of an Object."?
I’m trying to finish a project only that is showing error on the foreach part, and in VSCODE does not report any problem. I’m learning C# now and I can’t figure it out on my own. this is…
-
0
votes1
answer48
viewsHow to return the values of a public List<Weather>?
I have an app in Windows Weather/Weather Forms I want to pull the Description data from the Weather Class public class weather { public string descrição { get; set; } } void getWeather(string city)…
-
0
votes0
answers28
viewsRefer to a table in another database on the same server
I’m making an app on C# and .NET Core (ASP.NET Core MVC) using the EntityFrameworkCore and in the Connection String access to a database, say DB1, and I can read the tables in this database…
-
0
votes1
answer556
viewsVisual Studio Code does not suggest Unity methods and classes
If I type the code and pass it to Unity, Unity runs the code normally, but Visual Studio is not recognizing Unity (as you can see in the colors of the photo below), which makes it very difficult to…
-
0
votes0
answers49
viewsTake 3 values
I have a Combobox, which run the following search: public DataTable Localizar(String valor) { DataTable tabela = new DataTable(); SqlDataAdapter da = new SqlDataAdapter("select sc.scat_loja as Loja,…
-
0
votes0
answers61
viewsC# - Manipulation of controls in event triggered by a multithreaded method of another class
Good morning, you guys. I’m developing a C# library using Visual Studio for software authentication/licensing. It’s something simple. It basically consists of a method that executes a continuous…
-
0
votes1
answer26
viewsMultiple pages with report RDLC C#
I’m using rdlc for reporting. I upload and retrieve the required data from a csv (collaborator, enrollment...). Within my routine while, I am using the following code to override the parameters of…
-
0
votes0
answers31
viewsI cannot get the Selected Dropdownlistfor element inside a Partialview to send to the Controller via Actionlink
Hello I have a Partialview that is filled with selected entries through previous filters. partial view is no more than the presentation of a table with multiple rows in which each row will be a…
-
0
votes0
answers17
viewsWCF - Bool returns Void
Hello, good morning, good morning! When I call the WCF service on the client side, a function that was made to return bool is returning void.. and even asks for more parameters than those indicated…
-
0
votes0
answers47
viewsCount lines in a group in a Reportviewer report (rdlc)
Good morning, everyone. I am developing a system for employee registration that needs to generate the individual point sheets of each employee, for this I am using Reportviewer. In the body of the…
-
0
votes0
answers12
viewsHow to access the properties of a class that is within another class?
I have this custom control: public class CustomButton : Button { public Test Test { get; set; } } And this class: public class Teste { public string MyProperty { get; set; } } I want to change this…
-
0
votes1
answer55
viewsFill PDF checkbox with iText7
Hello! I’m trying to check a checbox of my PDF, but I’m not getting it right. Instead of just checking one of the checkboxes, he’s always checking all 3 What I would like: What I am getting: PDF in…
-
0
votes0
answers32
viewsError in custom code fields when exporting Reportviewer (RDLC) report to PDF
I have a custom code in a Reportviewer (RDLC) report that basically checks whether a specific date is within a date range contained in a set of ranges coming from a database and returns a value. The…
-
0
votes1
answer48
viewsMy results did not match what was expected from Benford’s Law. Is there something wrong?
Hello, I’m a beginner programmer and I decided to write a "napkin draft" to test the Benford Law (Benford’s Law). Although the code is not good quality and poorly optimized, I believe that the…
-
0
votes1
answer18
viewscondition for listing
Personal talk. to starting in C# (as you will notice in the question haha) and to with a doubt I have a list of values list a = [1,2,4,5,9,8,1,4,5,2,10,18] would like to know if there is any way to…
c#asked 4 years ago user213582 11 -
0
votes1
answer127
viewsImplementing an API for a website’s business rules: is it an exaggeration? Or is it good practice?
In some places that I worked with C# MVC I saw two ways to program the business model of a web system, being them: coding inside the Controller of the web application; creating a web API Rest and…
-
0
votes2
answers92
viewsProblems when passing an object in an Httppost request
I’m creating a Dotnet API, and when I tried to test a Post request with Postman the only data coming to my controller’s method is Name and CPF. Below is an image with the request I’m making in…
-
0
votes0
answers8
viewsNullreferenceexception: Object Reference not set to an instance of an Object gameController.Update Unity 2D
I’m starting to develop games now, and I was trying to make a system for when the player was at a certain distance from the object and pressed space the object moved in the direction the player was…
-
0
votes1
answer54
viewsEntity Framework trying to insert duplicate record
I am starting an application in Blazor, using Entity Framework and Mysql database. Below I will detail the Tables, Models, Context and Method that is presenting me problem: Tables:…
-
0
votes1
answer65
viewsHow to generate a PDF from a string
After making an HTTP request to an API that promises to return one: "nrwexPDF" I have the following return: "%PDF-1.2 \r\n1 0 obj\r\n<<\r\n/Type /Catalog\r\n/Pages 3 0…
-
0
votes1
answer233
viewsQuery user in Sql server
As I do to return instead of a query through a fixed user, the code was in the database to query the users and return it. I use Sql Server with aspnet core 3.1 application Someone who can help me in…
-
0
votes0
answers21
viewsReturn xml with 406, Net Core 2.2, with Formatfilter?
I’m trying to make a comeback in mine Controller with FormatFilter .xml, but I get the 406. Controller: [HttpGet("xml/loja/{id}/{format}"), FormatFilter] [Produces("application/xml")]…
-
0
votes0
answers7
viewsSystem.Nullreferenceexception: 'Undefined object reference for an instance of an object. ' Mongo was null
I need to make a confirmation in the code, where the client inserts the cnpj and if it is already in the database, it will be possible to continue the registration, otherwise the code will be…
-
0
votes0
answers10
views"System.Indexoutofrangeexception" in my project c#
In my financial software project I am trying to select in the database and have as a result the moves to be accounted for the balance, in my program I can already addlas in the database and all the…
-
0
votes1
answer72
viewsHow to make a chronometer with millisecond accuracy?
Hello, I’m a beginner and decided to create a stopwatch function to practice some techniques. The timer can mark the time downward (e.g.: 10.9.8.7.6.5) or upward (9.10.11.12), and the user can…
-
0
votes1
answer103
viewsDate filter problem in C# (Mongodb)
I’m trying to filter between dates in C# on a table in Mongodb. Expected results should be between 19/11/2020 and 20/11/2020. This is my code on C#: collection.Find<Admissao>(x =>…
-
0
votes1
answer47
viewsHow to replicate the same image in the header? C# Asp.Net
I am trying to replicate the same image in the header of all pages, but it appears broken. What can it be? It is a program done in c#, Asp.net. I already searched but could not fix. From what I…
-
0
votes1
answer199
viewsSystem.Formatexception: 'String not recognized as valid Datetime
Hello, I am trying to update data from a row of a db sqlite, however I am having problem in a date field. I enter data in the Registered field with the following code, where Tb_data_registered is a…
-
0
votes0
answers24
viewsApplication . net does not create service in windows (sc create)
I have the following code: public static void CriarServico(string nomeServico, string caminhoExecutavel) { try { string arguments = string.Format("create {0} binPath={1} type=own start=auto",…
-
0
votes1
answer42
viewsHow to generate summary comments of methods, properties and etc in C#
Here’s the thing, guys. I know that to create a summary in a given Method just put "//" in Visual Studio that Intellisense, automatically puts the following: Example: /// <summary> /// ///…
c#asked 3 years, 11 months ago Oto Emerson 25 -
0
votes0
answers40
viewsC# Xamarin.Forms
I’m looking for a way to, in a record, correlate state with city through Picker selection. Does anyone help? It’s for Xamarin Forms. Here are the codes: <Entry x:Name="EntryTelefone"…
-
0
votes0
answers41
viewsException "Property 'System.Datetime Date' is not defined for type 'System.Nullable`1[System.Datetime]' (Parameter 'Property')"
I upgraded EF Core to version 3.1.6 and am getting this exception when running a test. The methods that cause this are these two: public static IQueryable<CashoutRequest>…
-
0
votes1
answer70
viewsWrite to new column of a csv file using Stringbuilder c#
I saw an example of code right here in stackoverflow where I use the example below to write a CSV file using stringbuilder: public void ExportarCsv(List<Result> erros) { string filename =…
-
0
votes1
answer42
viewssqldatetime overflow c# When trying to use type = Date in Razor Using . NET MVC
When trying to save a change from a client, the SQL Server database is returning the following message: Sqldatetime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. View:…
-
0
votes1
answer39
viewsERROR: cannot Convert from 'int' to 'CRUD.Models.Times'
hello! I am doing a crud project on Asp net mvc and my code presents the following error: Severity Code Description Project File Line Suppression State Error CS1503 Argument 1: cannot Convert from…
-
0
votes1
answer37
viewsASPNET Core - Error 500 when posting a method that returns a Partialview with only one object
I have a method in my controller called ListagemTarefasEmDesenvolvimento() that returns me a PartialView. However, when I call this method via ajax, the server gives me a status error 500. Below is…
-
0
votes1
answer50
viewsHow to put an ID in a variable? ASP.NET MVC
I currently have a view where a Table(Orders) is being loaded another table(Colors) I want each order to be a list of the color that has the same ID as the order. My Tables: public partial class…
-
0
votes1
answer35
viewsRegistration game with Postman
Hello, I’m trying to make a registration of a game but when I try to run by Postman it does not work and says that everything is null Code [HttpPost] public async Task<IActionResult>…
-
0
votes1
answer71
viewsHow to convert Enum to string?
Hello, I want to list the elements of the class called, but the Status is of type Enum, when trying to convert to string, appears the message: "It is not possible to implicitly convert type 'string'…
c#asked 3 years, 11 months ago wrafanunes 21 -
0
votes1
answer62
viewsCharts.js Problem to bring Data to the chart!
I have a Google Charts chart that works perfectly bringing the database data through ajax, but I tried to do the same with Charts.js and I can’t. I would like to know how I put real data on the…
-
0
votes1
answer39
viewsC#: Sending data to database (Sqlcompact)
I’m starting now with C# due to the need where I work, I took a project until it was flowing, however, I’m having great difficulty sending the data to the database (a part of the code another person…
-
0
votes0
answers52
viewsUnit Testing . net MVC - Httpcontext Problem
Good afternoon, I have the following application as Solution: Controller: public ActionResult Index() { string username = HttpContext.Current.Request.LogonUserIdentity.Name; UtilizadorDbo…
-
0
votes0
answers51
viewsHow to group a table by date in the C# and entityframework?
Next, I have this table : CREATE TABLE [dbo].[lcr_LogLastAccess] ( [Id] INT IDENTITY (1, 1) NOT NULL, [logl_Company] VARCHAR (100) NULL, [logl_Name] VARCHAR (100) NULL, [logl_Login] VARCHAR (100)…
-
0
votes2
answers28
viewsVisual Studio (C#): Use web.debug.config without publishing
I would like to have 2 configuration files in my application c#. They would be web.config and web.debug.config. The goal of this is that I can put some settings like database access and some…