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
-
1
votes3
answers373
viewsError hiding dataGridView line
Hello, I need to hide all the lines from dataGridView containing in the column data, the date lower than the current date, ie with the code below I get the following error: Não é possível tornar…
c#asked 5 years, 8 months ago Marlon Pereira 465 -
1
votes1
answer109
viewsHow to resize 2 Datagridview equally?
I have a form with 2 DataGridView and when resizing the form I can only resize 1 of DataGridView on all sides (with anchor 4 sides) without overlapping the other side DataGridView. Taking the image…
-
1
votes1
answer235
viewsXML serialization/deserialization C#
Good night! I can’t use the data I do the XML deserialization, there is no exception or anything like that... I already checked the path, data but I can not list the data... XML: <?xml…
-
1
votes1
answer158
viewsFunction to generate fixed day-to-day launch
I have this function that when starting with T it will generate invoice for every day, example: if you have T10 will generate every day 10 as specified in the form of payment. Currently being done…
-
1
votes1
answer138
viewsChange the Excel icon
Hello, I start apologizing, I’m not from C or C++, but I really need a help that can be given by as much as the other, I work with Excel solutions modeling the XML interface, I created an…
-
1
votes0
answers119
viewsCheck if any user has logged in, and pick up the logged in user - core 2.1
Hello I need to check if there is any user authentication, and after checking if any user has authenticated to get this user’s ID. I own a Middleware that redirects the user to condominium…
-
1
votes0
answers61
viewsAPI bearer client authentication
I have a API that return token bearer, normal, as per image The question is this, it has an application MVC that consumes this API, and I want to put [Authorize] in the classes of that MVC…
-
1
votes1
answer272
viewsCheck if the user has authenticated, and get authenticated user information
I want to check if you had any user authentication, and after checking if any user authenticated to get that user’s ID. I have a Middleware that will redirect the user to condominium registration…
-
1
votes1
answer111
viewsPopular a Combobox from the selection of another Combobox
I really have no idea how to do this, but if this is really possible it would be very helpful to me, I tried in some ways but none of it worked I have a ComboBox cboBusca where I select what I want…
-
1
votes3
answers101
viewsOperator ?: does not work
I’m doing the union, in one of select i need to make a condition to appear in the correct way. To not keep appearing blank values. I tried to do it this way: Documento =…
-
1
votes1
answer48
viewsDoubts about validation for the implementation of the modal
Hello, I’m making a control system and ended up locking in one part, I have two classes, the equipamento and the area, where an area may have one or many equipment and an equipment belongs to a…
-
1
votes1
answer36
viewsAsynchronous method
Good morning, I have an ASP.NET MVC 5 application that opens IT calls, I have a procedure that triggers e-mail to users at the end of the task execution (completion, opening, forwarding, etc. of the…
-
1
votes1
answer330
viewsBasic Auth API connection
I need to connect to an API in the HTTP GET METHOD with Basic Auth. I took this example on the net, adjusted but it’s not returning anything. string username = "179341"; string password = "12CC97";…
c#asked 5 years, 7 months ago João Bosco 41 -
1
votes1
answer26
viewsError in GDI+ when selecting active frame
I have a problem when I try to split multi-page TIFF files. As I divide the files, I save each page in a temporary folder and save a JPG from that TIFF to use it as a thumbnail of the image in…
-
1
votes0
answers45
viewsMongoclient returns empty when selecting a Collection
I’m using the Mongodb Atlas with bank,and the Mongodbdriver to make the connection, but when selecting my Collection it returns empty instead of returning the collection data. My connection: class…
-
1
votes1
answer49
viewsNo constructor without parameters has been defined for this object. , Asp net mvc
When I will perform the insertion of this data in the table, this error occurs: No constructor without parameters has been defined for this object. Follow code with constructor: [HttpGet] public…
-
1
votes1
answer459
viewsEntity Framework Migrations on an already installed system, how to run?
A C# Winforms application, with the Entity Framework that accesses data in SQL Server in development phase we use Migrations to make the database according to our model, but then with the system…
-
1
votes1
answer32
viewsPass controller(action) information to a jquery function and vice versa
A jquery function will call a modal screen when changing a Dropdownlist. When I make the change, the value of id should be sent to Action there is then made a calculation and the result is sent to…
-
1
votes1
answer173
viewsConversion failed when Converting the varchar value 'COL' to data type int
I’m trying to register a project in a certain area, but every time I try to register it returns an exception. Exception: An Exception of type 'System.Data.Entity.Infrastructure.Dbupdateexception'…
-
1
votes1
answer33
viewsStack-overflow Exception in Servicehost object
I have a simple implementation of webservice. After years of software in use, began to burst exception on the object Servicehost. try { using (this._host = new ServiceHost(_receiver, new…
-
1
votes2
answers33
viewsUrl in jquery is being mounted wrong
I have a View called Invoice, inside a controller named Order. If I take my jquery and leave url: '', it already mounts in the browser that: locahost:porta/dominio/order/FaturarPara I’ll go to…
-
1
votes1
answer1163
viewsProblem with (Sql Server) insufficient system memory in Resource pool
I have a problem in some queries performed by the system, I analyzed the code and there is no error, more the bank is returning me to the message "There is insufficient system memory in Resource…
-
1
votes0
answers107
viewsHow to put one more condition in the Join on clause in a Linq/Lambda query
This query I run in the bank and is working as it should select rci.markuppercentual from resellercatalogitem rci join [Order] od on rci.ResellerCatalogId = od.ResellerCatalogId join OrderItem oi on…
-
1
votes1
answer83
viewsDependency injection and coupling - how wrong is this?
I created a project where the intention was to have a simple architecture, a rich domain and a webApi, but as soon as I started and already seeing the cagad*s, this is very bad? So come on, I…
c# asp.net-core pattern-design software-architecture dddasked 5 years, 7 months ago Márcio Sebastião 769 -
1
votes1
answer214
viewsHow to make an Insert in two distinct tables in C#
I need to enter values in an X table, then recover the id of it, so that I can send in the second Y table the id of X and other values, but I do not know how to do this. Follow the code below what…
-
1
votes0
answers69
viewsHow to create a Visual Studio C# property that opens the edit box
I’d like someone to help me with a situation. Whoever has an example please answer me. I would like to create a property in a User Control object, and that in this property opened the edit box, as…
-
1
votes1
answer182
viewsHow to close one Usercontrol and open another via Panel
I have userControlVicles inside a Panel, in this Usercontrol has a button to register a new vehicle, I want that when you click the button the panel closes or hide the current Ucontrol and show the…
-
1
votes1
answer130
viewsHow to know if a file exists through its url without needing to download it?
I have a file list, and I need to know if it was uploaded to a storage facility. The idea to facilitate the process is to concatenate the file name, generate a URL and try to download the file, if…
c#asked 5 years, 7 months ago Leonardo Bonetti 5,313 -
1
votes3
answers676
viewsFactor of a number chosen by the user
I’m not getting to be factorial expression, which is: 1 + (1/1! ) + (1/2! ) + (1/3! ) + ... + (1/n!) Whereas the number n is entered by the user. My code: Console.WriteLine("A expreção 1 + (1/1!) +…
-
1
votes1
answer528
viewsHow to correctly fill a Listview with <List> C#
I have a method public List <Veiculos> selectListVeiculos() { try { using (MySqlConnection conn = new MySqlConnection(_conexaoMySQL)) { using (MySqlCommand command = new MySqlCommand("Select…
-
1
votes1
answer78
viewsConvert JSON file to object - C# Xamarin
I have the following JSON file: { "createdAt":"Apr 17, 2019 10:28:39", "id":"52329770-64e2-4759-9d3d-f2595973de4e", "items":[ { "id":"82d2e4ab-da74-45df-a9ea-99cc257ead59", "name":"REFRIGERANTE KS",…
-
1
votes0
answers88
viewsLink n to n
I have a database and I wanted to dial n to n on C#, but I don’t know how to get the data from my other table. I wish where it says id_equipa the data of the team selected in the combobox Step to…
-
1
votes1
answer51
viewsWhere and when to decide which concrete class (which implements a given interface) should be instantiated?
Okay, this is the classic problem to be solved with the use of interfaces, right? Let’s take the example: I have a DLL that will be used by different companies, each with their bank and their Pessoa…
-
1
votes2
answers49
viewsOptimization/correction in "Dbcontext.Savechanges()"
having regard to the following scenario:: using (TransactionScope scope = new TransactionScope()) { var allObjects = new List<MyObject>(); var objects = myStaticClass.GetAllObjects(); foreach…
-
1
votes1
answer650
viewsC# - Windows Form how to search in a Datagridview
I have a datagridview which is populated from a list with data. When starting the screen I make a SELECT searching all bank records. How do I perform a search on this list and datagridview? My…
-
1
votes2
answers245
viewsHow to make a Class property of another Class? C#
I am doing a job of the facul that is for control of fleet of vehicles, I created a class Travel and I tried to put the classes Driver and Vehicle in this class. public Motorista {get; set;} public…
-
1
votes0
answers29
viewsHow are event subscribers executed after the call?
I’m trying to make a visual representation of random number generation using UWP. Basically, there are X rectangles on a screen, each represents a number, so the first rectangle is 0, the second 1…
-
1
votes1
answer50
viewsEntity Framework, code First, Database query
Good evening, I have two classes to which one is an attribute of the other, Customer has Anamnese , when I search the database the return is the right customer, but the field Anamnese is null, and I…
-
1
votes1
answer56
viewscreate a Pre (ETL) Extract, Transform, load with console c#
I have an activity and I don’t know where to start, I have to create a Pre ETL to consume and transform a .txt follows data: Price List The Price List file will arrive with the following name:…
c#asked 5 years, 7 months ago Wesley Dias 35 -
1
votes1
answer75
viewsVisual Studio not respecting ASP.NET Core Templates
I have a project ASP.NET Core 2.2 And within the project I have the Templates folder that has my Custom Scanfolding, for some reason it stopped working, I used it a lot. Today after several updates…
-
1
votes2
answers47
viewsMysql Query with Infinite Loop in C#
I’m doing a project with creating dynamic objects with CSS, after he enters the for, he inserts all the data of the database right, but apparently at the end he makes an infinite loop and appears…
-
1
votes1
answer37
viewsReorder Listbox with Drag and Drop
Good morning friends! I have a Listbox in my application C# Windows Form. I’d like a way to use the events Drag-n-Drop for reorder the items within the listbox the way the user wants it. Basically I…
-
1
votes0
answers54
viewsTextbox ->when user adds value -> this value will be calculated with a calculation class was created and returns value in the next screen
Hello I’m having following problem maybe someone can help i am need to do on the following logic i created the following class in this class I added the methods now that trouble comes when user type…
c#asked 5 years, 7 months ago LUIZ AUGUSTO121235 19 -
1
votes1
answer30
viewsProblem with checkedListBox + drag-n-drop
Good morning, I have a problem with the component checkedListBox of my application C# Windows Form. In the following code I am using drag n drop to reorder items from checkedListBox, what is working…
-
1
votes1
answer39
viewsRelated entity on page Razor
I have a problem on a page Razor, I have a "Person" entity that has a relationship with the entity "Address" public class Pessoa { public int Id {get; set;} public string Nome {get; set;} public…
-
1
votes1
answer418
viewsAvoid simultaneous user access
I need to make the user not log in to the system (asp-net mvc) on different machines. The system is on the intranet and currently there is an Access table with date and time of access of the user…
-
1
votes1
answer74
viewsInvalid thread operation, Invoke method does not work
I have an online chat code, in it there is a list of logged in users on the system. There is a problem when adding the name of users on listBox; The error is as follows: Operação entre threads…
-
1
votes1
answer59
viewsDoubt about how to put two different things in the same view
Guys, I have a small system that registers equipment and software. In data modeling a device can have several software installed on it, so the first time I made a crud to register only the equipment…
-
1
votes1
answer41
viewsSearch only one record type in the database and show in Datagrid
How do you do a bank search and show on DataGrid, only that I select a category I’m not sure how to do this kind of search in the bank, when I select in the ComboBox1 the active word, it brings me…
-
1
votes1
answer37
viewsPanel that changes size C#
Good morning, I’m trying to do the following for my application Windows Forms C#. I have a Panel that by activating your event MouseHover, the panel expands its size and there inside the panel with…