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
answers177
viewsWhat is the need of Virtual to overwrite a method in another class?
I am developing a C# system and I came across an inheritance/polymorphism problem. I searched in Google and in Microsoft references, however, I did not find something to clarify my doubts. I am…
-
0
votes1
answer110
viewsRecording date range, with useful days in Dictionary
I need to build two methods in my system, which do the following: 1) Save to a dictionary<T> in C#, a crease of dates. For this I have a function that consumption in the Sqlserver here from…
-
0
votes0
answers39
viewsHow to receive a Webapi data parameter
I receive an xml in my webAPI and deserializo it. What I did, I took the exact XML template that I’m going to receive and I call my service locally, just for the test effect. So far so good, I can…
-
0
votes2
answers353
viewsPostback removes selected items Multiple dropdownlist
I have a static multiple Dropdownlist (ddl1) on my aspx page. It has 4 options, in which you can select from 0 to 4 options. Another Dropdownlist (ddl2) that is also static in the form has the…
-
0
votes3
answers1275
viewsChanging pictures from a Picturebox C# - Windows Form Aplication
Boa Tarde Personal, The thing is, I’m working with Windows form and creating a simple application that has a "load" button that opened a window to select an image in the picturebox, the code looked…
-
0
votes1
answer100
viewsScan multiple checkboxes in a C#groupbox
Good morning!! I have several checkboxes within the same form in Groupboxes separated by second. I would like to scan all these checkboxes that are inside the groupboxes where if checked receive S…
-
0
votes0
answers25
viewsHow to change the Model data being shown in Gridmvc?
I have a Gridmvc in my form where displays a list of units, in this grid has a text field, and a checkbox, I would like when the user type some text box or catch the check, this change reflected in…
-
0
votes1
answer200
viewsLoad data from one action to another
I have a Action HttpGet, where that Action receives two parameters, dataInicial, and dataFinal, this generates a report, in the same Action. only that I would like to send this data (List), to…
-
0
votes1
answer122
viewsHow do I perform select list list from the view for the Controller?
I have the following code in my view: @using (Html.BeginForm("DataAniv", "Mailing", FormMethod.Post)) { <div class="form-group"> <label for="sel1">Selecione o mês:</label>…
-
0
votes1
answer149
viewsAsp.net MVC form, no modal call after data validation
I tried to make the modal call through Viewbag, but to no avail. I made a Debugg to see how was the process and in the final step that would appear the modal informing the user that "contains…
-
0
votes2
answers62
viewsSearch images across subdirectories
I need to search for images in all subdirectories and present them in one picturebox, but the code I currently have only allows me to search in a single folder and without filtering by file types…
c#asked 6 years, 3 months ago Paulo Ferreira 25 -
0
votes0
answers110
viewsGroup with Lambda, ASP.NET MVC
I have a question here. I have a action which receives two parameters, two dates. This generates a list, but in this list, the same item is repeating. wanted to be able to make a sum of money. For a…
-
0
votes1
answer296
viewsHow do I use the "Math.Max" method in C# without creating a lot of variables?
I’m trying to solve an exercise that’s like this: Make an algorithm that reads the height and enrollment of ten students. Show the enrollment of the highest student and the lowest student And my…
-
0
votes1
answer84
viewsView document in pdf using printdocument
I am making a direct print on the printer using the printdocument, now I need to use this document to generate a pdf, and view using the Windows pdf, how to pass my code to pdf. follow the code I…
c#asked 6 years, 3 months ago Junior Guerreiro 617 -
0
votes1
answer295
viewsC# flow chart/organisation chart component
I am making a desktop application for product configuration, having as selection fields various options related to them, eg: model, voltage, application... where when selecting each one, the other…
-
0
votes1
answer215
views(Localdb) Error after Update-Database command -> "Cannot attach the file ...."
I am trying to use Sql Serve Localdb in an application with Entity Framework and Migrations, but when I give the Update-Database command, the following error occurs: Cannot attach the file 'C:…
c# .net entity-framework entity-framework-6 migrationsasked 6 years, 3 months ago Márcio Sebastião 769 -
0
votes0
answers580
viewsSQL - Align Column Values to Right
Hello! I wonder if by means of an SQL sentence there is any possibility of aligning the values of the columns to the right. Here is an example below that I can do via C#, but I wanted to do the…
-
0
votes0
answers171
viewsHow to define the order of a list dynamically using Linq and C#
Hello, I am creating a method so that I can return a list of people where, I pass the column that should be ordered and whether this is increasing or decreasing. Thus: public async…
-
0
votes2
answers929
viewsHow to use async/await in void return methods?
I have a problem in my application, where due to the large volume of processing, my Form lock. During my researches I found that a method async resolves this, however the functions performed on my…
-
0
votes1
answer33
viewsWhen I delete the model name is not shown
I did an action to delete and delete, but View delete does not show the value of the field, which comes from the model. This is cshtml: @model TreinamentoCrud.Models.Cidade @{ ViewBag.Title =…
-
0
votes1
answer99
viewsHow to treat an array with N lines and turn to a list to send to C#
I’m sending an array of angular js for the controller of C#, and I’m treating him with stringfy for json. Only in my way POST he gets nothing, just returns null Code C# public void Post(string…
-
0
votes1
answer301
viewsIs it possible to connect to a VPN via C#code?
My machine accesses the company’s VPN, and when I run the Console application on my machine, I need to be connected to it because the bank IP(10.0.0.7) is only accessible via VPN. The problem is,…
-
0
votes2
answers70
viewsI’m learning, so it’s a basic question
I would like to know why then, when the programme has been implemented, it fails to show Console.WriteLine("nome: {0}", nome); onscreen? string endereço, cpf, telefone, nome;…
-
0
votes1
answer54
viewsValidate date in editfor
I made a date mask and would like to know, how I validate the date right there, IE, already in Edit he does not accept date like: 23/16/9087. This is my date editfor <div class="form-group">…
-
0
votes0
answers519
viewsI am consuming an API with basic Authentication oauth and returns: Incorrect request (400)
Talk, you guys! Next, I developed an api in spring boot and already tested with Postman and it works normally, its security is a very basic oauth authentication. Now I’m testing in an application in…
-
0
votes1
answer148
viewsHow to save information(Cpf) from an Edit with mask and a numeric field
In the bank I have the CPF field of type bigint. In the model it is a long. This is what was requested in the requirement. Well, in the model I’ve been using a Datatype.Text to accept the mask, but…
-
0
votes0
answers560
viewsAjax request with JSON type parameter using Jquery 1.8.2
I am trying to make an ajax request that sends a list of objects, but it seems that in this version of Jquery 1.8.2 (I cannot update because the system is legacy and has many features using this…
-
0
votes0
answers262
viewsDirt in XML string, line break( n) sent whenever the field is empty!
I’m assembling a string that has as its final result an XML template just below, and when receiving at the other end, a line break character appears in the empty fields, I’ve tried using replace(),…
c#asked 6 years, 3 months ago Luciano Castilho 11 -
0
votes1
answer132
viewsDecimal field displays a . 0 on the screen
I have a CPF field that is decimal(11). Well, when I show on the grid the CPF it looks like this: 12345678911.0, as I can remove the . 0? My Viewmodel public class FuncionarioViewModel { [Key]…
-
0
votes1
answer61
viewsExtraction of different data from two object lists
I am working on a WEB API and need to remove some values contained in one list and which are contained in another. To be better illustrated would be the equivalent of removing the data from a list…
-
0
votes2
answers85
viewsDropdownlistfor with Viewbag and Dictonary returning null value
I would like the help of all to assist in the following problem: The error happens when it is still validating the fields. Controller: public ActionResult Create() { var vEmpresas = new…
-
0
votes0
answers731
viewsProblem with label printing Argox printer OS-214 Plus C#
The Argox OS-214 Plus printer is cutting the barcodes of products with 9 or more digits, making it impossible to read these codes. What can I do to make these 9 or more digit bar codes fit on the…
-
0
votes0
answers41
viewsPlugin.Geolocator.Abstractions.IGeolocator.Getpositionasync Indexoutofrangeexception
I’m using Xamarin.Forms and trying to get the position with the Plugin.Geolocator and Getpositionasync method falls into an exception of Indexoutofrangeexception var locator =…
-
0
votes1
answer267
viewsHow to disable the textchanged event in the load event in Visual Studio C#?
I have the following problem: I have a function that is called when the button triggers the textchanged event only when I start the program for the first time it calls the textchanged function in…
-
0
votes1
answer328
viewsDownload . txt to memory and read
How to download TXT in memory, read and save in a variable separated by , the words? I wanted to read with the slip (I think it’s the name, I don’t remember...). Here it is, it downloads the file to…
c#asked 6 years, 3 months ago Jonathan Ribeiro 1 -
0
votes2
answers52
viewsCompare and print comma separated data
I am unable to compare with the data in the notepad. This data is inserted online and separated by; In short, enter value;description;day;month;year if (dia == "" || mes == "" || ano == "") { ERRO…
-
0
votes1
answer79
viewsProblem with customErrors configuration ASP.NET MVC 4
I need to set up a generic error page for my site, added the following code in the web config: <system.web> <trust level="Full" /> <customErrors mode="On"…
-
0
votes1
answer53
viewsError showing SQL server Sum in DAO layer
I’m struggling to show the result of SUM in the DAO layer, the query brings the expected result, however, in the field where it is to show the sum, it does not show an error. The process in Sql…
-
0
votes1
answer94
viewsMethod that works without I call you directly
I’m messing with the Entity Framework and I was mapping to a Many to Many class. What happens is I used a method I can use inside the DbContext to rename a table, and it works smoothly. But I was…
-
0
votes1
answer552
viewsError: The object reference was not defined as an instance of a C#object
I wanted to make a table in console but all ran the program appears error in the method AlunoLista(), I’ve tried to make changes but I can’t get there. static void Main(string[] args) { var client =…
-
0
votes0
answers119
viewsProgress bar c# (windows form) using mysql data
I currently have this code in one of the formats of a developing application and would like to create a progress bar that by clicking the View button (which takes a while to fill the datagrid) would…
-
0
votes0
answers31
viewsHow to databind a texbox without assigning it a value?
I have a txtEmail textbox in a Display() method where I assign you an email (via a query) so that I can display it in a user profile (all ok). txtEmail.Text = item["email"].ToString();//devolve…
-
0
votes0
answers106
viewsDapper in 1-1 grating where in class there is no foreign key
When working with ORM it is common (Will it be mandatory?) to create the model classes as if they were a mirror of the tables of the bank. But I have a different case and I was wondering if Dapper…
-
0
votes1
answer97
viewsReport Viewer - app.config unknowingly
I am unable to make a Report Viewer connection with Mysql, it does not appear in the "Choose Data Source" list. I believe that the problem is in the "app.config" that is disfigured someone could…
-
0
votes2
answers446
viewsHow to pick up snippets between () a string
I’m doing a program that reads some mathematical expression like for example x^(3*x+1) + (cos x), it doesn’t necessarily have to be that expression, and I’d like to know how to get the specific…
-
0
votes0
answers50
viewsHow to detect that the text has created new lines
Let’s imagine I have a lable and has a text with n characters. Whenever this text does not fit he will put the words in the bottom line. How do I detect that this happened? I tried so internal int…
-
0
votes1
answer112
viewsSearch Object By date and Id Lambda, Linq, Asp.net
I have class called Requisicaodeveiculo, a class called Moving vehicle and class Vehicle. class RequisicaoDeVeiculo { public int Id { get; set; } public DateTime DataDaSolicitacao { get; set; }…
-
0
votes0
answers85
viewsDoes not delete record from list and SQL database
I would like you to delete the desired record not only from the list but from the bank as well, how can I proceed? He’s going with the id "0" Instead of taking the id of the record I wish to delete.…
-
0
votes1
answer53
viewsParse URL image
How can I do instead of sending an parse to the location it parses an image from a remote address or a url. Because if I try to replace the address: C: Users Format Downloads JRMJ.jpg with a URL the…
-
0
votes2
answers234
viewsPass two parameters at once to the controller - A parameter is in an Input Group
Good morning, everyone. I’m new to Asp.Net and I took a personal project to do, but I’m having trouble passing parameters to the controller. I don’t know how to pass more than one parameter at a…