Most voted ".net" questions
The Microsoft . NET is a set of libraries and functions that are part of the Basic Class Library (BCL), such as user interface functions, data access, connectivity, cryptography, web development, mathematical algorithms, and network communication.
Learn more…2,689 questions
Sort by count of
-
1
votes1
answer54
viewsAlternatives to Microsoft Lightswitch
I have an application developed in . NET using a Microsoft extension called Lightswitch that unfortunately I can’t open or run. However, it has become obsolete. What are the best alternatives in…
-
1
votes1
answer156
viewsError while using Parallel.Foreach
I am making some improvements in a method, which today takes on average 19 to 22s to bring the information to VIEW and saw the possibility of replacing the foreach for Parallel.Foreach. I changed…
-
1
votes1
answer3574
viewsCalculate percentage
Largura * Complemento = Subtotal + Porcentagem = Total subtotal.Text = (Convert.ToDouble(largura.Text) * Convert.ToDouble(complemento.Text)).ToString(); total.Text = (Convert.ToDouble(subtotal.Text)…
-
1
votes1
answer124
viewsNullreferenceexception in Winforms code
I believe it’s a bug not the code, but the compiler... When I eat this area of code, the error always goes to the next variable, or method. Behold: Part of the code: grpBoxMDeck[i] = new…
-
1
votes1
answer400
viewsHow to receive a form with file and form in controller ? C #
So I get the form: public JsonResult Import(**FormCollection** form) So I get the file: public JsonResult Import(**HttpPostedFileBase** file) $.ajax({ url: urlImport, method: 'post', data: new…
-
1
votes1
answer40
viewsError debugging webservice (asmx) locally in Visual Studio
I’m trying to locally debug a webservice (asmx) from Visual Studio. When trying to create the connection to the database, the following exception occurs: Failure to request type permission…
-
1
votes0
answers361
viewsCalling a DLL . NET C# method from a Classic ASP application
I have a web system in ASP that does the storage management (WMS). The system works and is already in use in some companies. Recently there was the need to work with labels that will be pasted in…
-
1
votes1
answer712
viewsHow to resolve reference error in Visual Studio Community 2017?
I want to solve a reference error when I click on a word. I used visual studio 2013 and had the "resove > reference". But in the visual studio 2017 community how can I resolve all reference…
-
1
votes1
answer452
viewsKnow the size of each element of a list
Assuming I have one List<byte[]> Imagens; and I want to know if any element on that list has more than 1 mega, I could do it via foreach, checking item by item: foreach (var item in Imagens)…
-
1
votes1
answer751
viewsCS0266 error Cannot convert implicitly
When trying to make a list where you will filter only the 5 largest records by values in descending order I am experiencing this error: CS0266 error Cannot convert type implicitly…
-
1
votes1
answer721
viewsConnect to database using . Net Core 2
I am studying . Net Core 2 and I am unable to make the connection to the database. My appsettings.json looks like this: "ConnectionStrings": { "DefaultConnection":…
-
1
votes0
answers51
viewsEntity mapping with . Net Core 2
have the following entities: public class Transacao : IEntity { [Key] public int Id { get; private set; } public int LojaId { get; set; } public virtual Loja Loja { get; set; } public int…
-
1
votes0
answers45
viewsZxing does not read CODE 128 Barcode with more than 8 characters
I need some help, I made a code to read Barcode from the camera of the Cell phone. When I put more than 8 characters in CODE 128 the system does not read. In other formats Read but in code 128 no.…
-
1
votes0
answers64
viewsOauth Authentication doesn’t work in Azure Function
I created a webapi selfhost and used Oauth to generate an authentication token, it worked as a console application but when I try to create a function in Azure it only return server error(500) My…
-
1
votes0
answers70
viewsElastic transactions with MS SQL Server
Considering the following code snippet: using (var scope = new TransactionScope()) { using (var conn1 = new SqlConnection(connStrDb1)) { conn1.Open(); SqlCommand cmd1 = conn1.CreateCommand();…
-
1
votes2
answers682
viewsExtract XML C#tags
I was able to get a tag, but I couldn’t find a way to take a tag that repeats itself and store each repetition in a list. XML example <casa> <porta> <janela>Janela 1</janela>…
-
1
votes1
answer1106
viewsConvert double to string keeping the same format
I need to convert a value of type double for string in C#, without this value being changed to scientific notation. my code is: double valor1 = 0.000024746578864525161; string resultado =…
-
1
votes1
answer616
viewsASP.NET MVC error circular reference when serializing object
Good afternoon dear comrades! I am a beginner in ASP.NET MVC and in C#, I am developing a project and I found a problem. Basically, it’s a store registration system. I have two tables, one called…
-
1
votes1
answer445
viewsHow to get the exact value of the division with the decimal places after the comma?
I need to do a percentage calculation, but I’m not getting the exact amount. Example: int valorUni = 8; int valorTotal = 116; double result; result = (valorUni / valorTotal) * 100; //Resultado…
-
1
votes1
answer311
viewsif and Else condition with date in Crystal report
I am fulfilling a condition in my report in order to insert "-" when the Due date is null, but error occurs when the date comes other than null. Below is the image that shows the error when I fill…
-
1
votes1
answer132
viewsSQL command blocking controller requests in C# MVC
I am implementing in a C# MVC project, a routine to run the database Store. I’m having trouble that when I start doing the Store, other requests controllers are locked, waiting for SQL to finish.…
-
1
votes3
answers124
viewsUse of "Contains" in search expression
I have a string _Users of the kind List, it contains several lines. Each line consists of an integer and a string separated by comma (in general it is only one string): ID (numbers only),name…
-
1
votes1
answer45
viewsHow to make a LINQ query that returns the amount of people who were born per month?
I would like to make a LINQ query that returns the amount of people who were born in the month. In Mysql I do this query: SELECT COUNT(*) AS DataNacimento FROM pessoas WHERE MONTH (DataNascimento) =…
-
1
votes1
answer459
viewsCreating a C#Client-Server architecture
I made a test application in N layers (access to Database, presentation, business (model) and transfer objects) worked quietly and learned a lot about 3 layers and N layers. Now I’m willing to do a…
-
1
votes1
answer39
viewsMy Javascript/AJAX function is not converting Date to the correct format
Hello I’m having a problem with an MVC project. My View needs to return Data values to some Text Boxes (from the record selection by a Data Table) so that the user can do the record Edit. The…
-
1
votes2
answers109
viewsIs it wrong to put this much code into a button click event?
It is wrong to put this amount of code in an event of click button? private void CPeBTNSalvar_Click(object sender, EventArgs e) { try { if (CPeTBCodigo.Text == "") { throw new…
-
1
votes1
answer48
viewsMapping with Entity Framework
Good afternoon, when analyzing a code I see in the mapping the following line: this.HasKey(t => t.IdEstudante); I understand what you do in practice but not theoretically, refers to the object…
-
1
votes0
answers30
viewsWindows authentication
My Windows authentication is getting lost with time. I do the following validation: if(HttpContext.Current.User.Identity.IsAuthenticated == true) dsHostName =…
-
1
votes2
answers113
viewsDoubt C# ADO.NET class - Accessing data from a Datatable
Hello, good evening, I’m new here and a beginner in C programming#. I am developing a CRUD vinyl record system (a particular hahaha addiction), using ADO.NET classes, similar to the article below.…
-
1
votes0
answers36
viewsIs it possible to make a related Entity possible to display with Odata Expand (Webapi)?
Hello, I have a question regarding the following situation: I have an Entity that I defined in my model as Tasfafreq public partial class TarefaFreq { [Key] public int ID { get; set; } public string…
-
1
votes1
answer319
viewsRemove element from the list in C#
I have a list and I want that after the foreach from that list, remove all elements from it, the method RemoveAll() asks parameter, but I don’t know which parameter to pass. foreach (var lista in…
-
1
votes0
answers1617
viewsC# Httpwebrequest send Multipart/form-data in POST
I need to send one POST using HttpWebRequest, with the header Content-Type=multipart/form-data and Accept=multipart/form-data, and the data in Body. My routine below, I use it smoothly doing POST,…
-
1
votes2
answers396
viewsGet next record on a grouped foreach
How could I be selecting the next record within a foreach grouped before it ends, without advancing on that loop? The point where I think I might be getting this information is where it’s written…
-
1
votes1
answer601
viewsHow to print Qrcode on Epson TM T20 VB.NET printer
I’m trying to print a QR Code on the Epson TM-T20 printer using the VB.NET language and it is returning several characters on the electronic tax coupon reel, could someone help me? Follow the code…
-
1
votes1
answer94
viewsError creating XML with Xmlwriter
I need to create an XML, but when I try to create 2 error elements, how do I generate 1 XML with two elements? follows my code class Program { static void Main(string[] args) { using (XmlWriter…
-
1
votes2
answers499
viewsSql server skipping record id
After changing an application record, the next record I entered in the table skipped 1000 increments in id. id’s 2 3 4 5 6 7 8 9 1015 1016
-
1
votes1
answer156
viewsWhat are the differences between Thread and Promise
I am more of the desktop world, but I’m wanting to know more about WEB. And I wonder if there is a difference between javascript and C thread#.
-
1
votes1
answer77
viewsC# - Collections - Enigma Exercise
Hello, I was making a college exercise list and I came across this exercise, where you have a part of the code and it asks you to find out what code structure it belongs to. In my view, this seems…
-
1
votes1
answer224
viewsError building with Jenkins and Msbuild
I’m trying to create a build job in Jenkins, I’ve already set up the folder where he searches the Msbuild.exe and also the plugin however at the time I put it to run gives this error: ` C: Program…
-
1
votes0
answers61
viewsHow to Truncate decimal values in C#
I am trying to truncate the values (without rounding) according to the number of decimals passed per parameter, but the Math.Truncate function does not have this feature... Is there any way I can do…
-
1
votes2
answers70
viewsChoose path index
Hello, I’m with a project . NET Core Razor. My page index is inside the folder Pages, and I would like to put my page index inside the Test folder that is inside the pages folder, for example…
-
1
votes4
answers1449
viewsUndefined object reference for an object instance in array
I have a problem. I have to make a video rental program in which you say the data of 5 movies, and then the program lists all the information! And it is mandatory to make a class for this! I’ve done…
-
1
votes2
answers862
viewsNo parameterless constructor defined for this Object
I am trying to create a constructor with parameters as shown below: public class TestController : Controller { private readonly IAppService _servico; public DashboardController(IAppService servico)…
-
1
votes1
answer175
views -
1
votes2
answers89
viewsRename field in a lambda
In SQL I do so: select campo1 as teste from tabela And in a lambda? How would I do? I have this lambda with several tables and the field ValuePayment is repeated several times. var qry =…
-
1
votes2
answers1233
viewsPass Json object array to Controller C# . NET
I need to do a post, and so far I’m trying to do by AJAX to send an object to the Controller, but I’m having trouble receiving the object. View/html: <select name="Servers" id="servers"…
-
1
votes0
answers113
viewsHow to format graphics axes in visual studio
Guys, I’m trying to put together a Payback chart, but it’s really weird. I used the following code (summary of what influences): Public vetor_x(121) As Integer Public vetor_y(121) As Double Private…
-
1
votes1
answer58
viewsHow to fire multiple errors in a single data check using C#
I am creating a solution where I would like to keep all business rules within my models including the answer to errors. The problem is that I would also like to be able to capture multiple errors at…
-
1
votes2
answers166
viewsHow to return the name of an instance of a class?
To avoid having to manually type the data after an update to the objects, I decided to create a method of type static to be accessed by passing the object as parameter. public static void…
-
1
votes3
answers154
viewsHow to "mount" a multiple variable?
Would it be possible to mount a variable to pass a value to it? For example: var teste0 = "valor"; var teste1 = "outro valor"; var teste2 = "mais um valor"; for(int i=0;i<3;i++){ teste+i = "mudou…