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
votes1
answer29
viewsChange scaffold C#generated controllers
Good people, I was studying about Entity Framework and saw that there is the scaffolding tool that generates a complete CRUD with controllers and views. My doubt is that if I can change the logic of…
-
0
votes1
answer43
viewsc# visual studio!! how do I get my form to occupy the entire screen? it’s only half the screen!
This is the image of my form if you fix it it is not occupying the whole screen. I would like to know how to do to occupy the whole screen.…
c#asked 5 years, 7 months ago Wanderson Pegazus 1 -
0
votes1
answer455
viewsPass Viewmodel properties to Controller
I put my table inside a BeginForm passing my controller and my action, but when I give Submit the fields are NULL in the controller, I don’t think this passing the properties of Viewmodel. @model…
-
0
votes2
answers189
viewsConvert Type to List
Good afternoon, I’m developing a project in C# and I have an error now that I’m not solving. Cannot implicitly Convert type 'Itcore.FlowCredit.Business.Entities.Productmortizacaocreditodiassearch'…
c#asked 7 years, 9 months ago Ricardo Gonçalves 83 -
0
votes1
answer63
viewsVariable interfering with value of other variable
Good afternoon Gentlemen. I’m facing a problem I’ve never seen before, below I have a view mapped in the EF with effluent var viewRelatorio = db.view.where(ra.DataBruta.Month ==…
-
0
votes1
answer601
viewsCannot implicitly Convert type list to an Object
Good night, I’m doubting the following mistake: Cannot implicitly Convert type 'System.Collections.Generic.List' to 'ITCore.FlowCredit.Business.Entities.ProdutoAmortizacaoCreditoDiasSearch' The…
-
0
votes1
answer71
viewsHow do you put that in a for cycle?
code: if (label1.Text != string.Empty && label2.Text != string.Empty && label3.Text != string.Empty && label4.Text != string.Empty && label5.Text != string.Empty…
c#asked 5 years, 7 months ago Gonçalo Sousa 103 -
0
votes1
answer562
viewsError conversion type Object to int
I am making a select in the database, using Execscalar returning an Object but I cannot cast this value returned to integer. public static int ConsultaPDVsAtivos() { NpgsqlCommand sql = new…
-
0
votes1
answer751
viewsBuilding Datagrid with C# WPF at runtime
I have a Datatable where I will store some data that the user informs and through it I want to pass the information to Datagrid. gvDados.ItemsSource = dt.DefaultView; //Essa é a ligação entre o…
-
0
votes2
answers2249
viewsHow to resolve a string formatting error?
I was programming normally in VS in "Console" mode when I came across this message: "A first chance Exception of type 'System.Formatexception' occurred in mscorlib.dll An unhandled Exception of type…
-
0
votes1
answer50
viewsError accessing C# Visual Studio database
I’m doing a job of the facul, and I started him on the job this week, then came weekend I put the project on the USB stick and exported the database by Mysqlworkbench tbem, I was able to import the…
-
0
votes0
answers125
viewsSetting the Row Header of a Datagrid through the rows of a Datatable column using C# WPF
I have a Datatable with the following information : Column1 | Column2 1 | A 2 | B 3 | C 4 | D With this Datatable I would like to load a Datagrid using the first column of Datatable to be the Row…
-
0
votes1
answer95
viewsWhat command can I use to delete an item from a Repeater in c# Asp.net
I am trying to delete an item from a Reset, this item is a "registered" person. Because there is no database involved I am aware of Repeater1.Controls.Remove, but this does not exclude. Information…
-
0
votes1
answer33
viewsRoute stopped working only in release version
I have software here at the company, and it worked perfectly. However, I made a small layout change and my machine works perfectly. When I publish the application, the route (/Configurations)…
-
0
votes2
answers567
viewsMatrix Printer does not reconfigure paper size
I am using a dot matrix printer to print receipts. I installed it as Generic text only. But send the print, it recognizes the height as A4 paper. How to make the printer cut the paper when there are…
-
0
votes1
answer155
viewsHow to change the properties of a Form being inside a Usercontrol that is not in the Form? C#
In my code I am inside a Usercontrol that is not inside the Form and I would like to change the properties of my Form through this Usercontrol. Example of my code: private void btn_Click(object…
-
0
votes0
answers257
viewsPhone validation C#
Some time ago I searched here validation for the phone number that only accepted the format type (11) 98162-7844 or (11) 8162-7844, however I did not find a validation for the "existing" or…
-
0
votes1
answer68
viewsWindows Forms + windows service
I have a windows Forms project, added a windows service class, would like to install the service and run from a one button event(no need to use Installutil). There’s some way to do it?
-
0
votes2
answers260
viewsImplement Progressbar
//cria conexao com o DB OleDbConnection aConnection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Casa\Desktop\Inventario.mdb"); //comando SQL OleDbCommand aCommand =…
-
0
votes1
answer34
viewsJOB LINQ to update values in the database!
I have a JOB in which I need to update all the values to the maximum value that exists for a column, but my code is not working. Can someone help me? My code: List<SqlOnlyCostModel> costat =…
-
0
votes0
answers37
viewsC#, Visual Studio ASP NET Core
I don’t know what I did with my Visual Studio, but when I create a new file in ASP NET Core MVC it doesn’t create the controllers and etc. Besides the error that appears. Thanks for the help!…
-
0
votes1
answer85
viewsSearching between two dates
I have a C# program that assembles a report and can filter by name, but I want to go further, I wanted to pull all the records between two dates. Good as I do to assemble the WHERE of that filter by…
-
0
votes1
answer437
viewsHow to create this expression in C#
At first, the program I made the calculation using the following expression: valorComDescontos = valorTotal - (valorTotal * percentual); Where the valorTotal is a value assigned by the user (a…
-
0
votes0
answers261
viewsrzc generate exited with code -2147450749
I am starting a new application and when I have buildar of this error... someone there could give me a help ? i just put a new html code. Version of dotnet: Error presented: rzc generate exited with…
-
0
votes1
answer85
viewsC# Wpf Passwordbox want to spy the password
Good evening, I have some Passwordbox and would like to add buttons to spy this password when the user needs it, I tried to invoke the Passwordrevealmode inside the Passwordbox, however it does not…
-
0
votes1
answer220
viewsEmpty generated migration after Scaffolding
I’m studying ASP.NET MVC5, so I created a model called RelatorioTagModels: public class RelatorioTagModels { [Key] public int TagID { get; set; } [Required] public decimal Tag { get; set; }…
-
0
votes1
answer295
viewsProblems with Scriptmanager.Registerclientscriptblock
My btnDownloadArchitect_Click function. protected void btnDownloadArquivos_Click(object sender, EventArgs e) { Response.ContentType = "application/octet-stream";…
-
0
votes0
answers31
viewsC# MVC - Different context
Good morning, I have two Dbcontextprincipal and Dbcontexthist context that have the classes Bill and Contahist, respectively. In the main Dbcontext has the class Client. I would like to do the Join…
-
0
votes1
answer29
viewsHow to get duplicate items for specific Ids?
How do I get the list of repeating items with the same fpId and eclId? var lst = (from fp in FPIds from et in ETIds from ec in ECIds join eclp in ECLP on ec equals eclp.ecId join ecl in ECL on…
-
0
votes1
answer26
viewsConvert WBMP image
Good afternoon, How to convert a wbmp image to png or jpg using Asp.net core ? I tried to use the ImageSharp, but it doesn’t seem to support wbmp.
-
0
votes1
answer60
viewsDisplay runtime of an application [C#]
I would like help with a process I need to do: The idea is to create an informative label that will contain as many hours, minutes and seconds as my application is working. Time starts to count as…
-
0
votes1
answer32
viewsHow to write this query using lambda Linq in c#
The query I have to pass to lamba is as follows: select * from Linguagem inner join Cadastro on Lin_ID=Cad_IDLinguagem and Cad_Situation=0 only coonsegui do until the part of the joint but Where do…
-
0
votes0
answers125
viewsData Annotation with Real Values
I have the following model: [Display(Name = "Valor")] [DataType(DataType.Currency)] public decimal Valor { get; set; } View: <div class="form-group"> @Html.LabelFor(m => m.Valor, "Valor",…
-
0
votes3
answers261
viewsCRUD Object Oriented Programming
I’m a little confused about how we persist in an object-oriented programming structure, I’m not sure how to explain it, let’s imagine the object Person and for example through Heritage create the…
-
0
votes1
answer89
viewsSort and sort a string
Then with the sequence sorted and ordered crescently need to exclude all characters that come after (and including) the symbol "_" (without quotation marks). Could you help me where I should start ?…
-
0
votes1
answer45
viewsGet higher separate value according to product code in datatable
My project has a DataTable with four columns. I would like to know how to get only the items of this DataTable which, according to its occurrence, has the largest separate quantity? For example:…
-
0
votes1
answer355
viewsPOST Web API method returning null
I am making a Web API in C# ASP.NET and in the POST method the value is returning me null. I’m using Postman to play a JSON within value but still returns me null. public string…
-
0
votes2
answers978
viewsList<Model> Actionresult() MVC
Guys, I need you to help me figure out where I’m going wrong and how to fix a little problem. I don’t know much about MVC, but I’m turning around here. I need to pass a Model class as a parameter to…
-
0
votes2
answers736
viewsError: connection to database already opened
I am creating a method to test a connection with the Postgresql database, but when calling the method that opens the connection an error happens saying that the connection is already open and does…
-
0
votes2
answers1130
viewsWebservice consumption only runs in debugging under the Visual Studio IDE
My Winforms VB.NET application consumes a webservice to perform some queries. When running in debug or release mode under the Visual Studio IDE, it works perfectly, but once it’s distributed on the…
-
0
votes1
answer1846
viewsHow to use the Contains method in a search using the Entityframework
I’m trying to make the following consultation sql, using the Entityframework: select * from pedidos where pedidoID not in (select pedidoID from agendamentos); I conducted some research and…
-
0
votes1
answer728
viewsCode first Migrations does not work
I did it in a separate layer called Data public class Context : DbContext { public Context() : base("EscolaContext") { } public DbSet<Escola> Escolas { get; set; } public DbSet<Turma>…
-
0
votes0
answers76
viewsServer terminating connection when consuming the same service for the second time
I have a problem, consuming the same method of a service for more than once, during the first call the method works normally, but when the same method is called in another part of the code, with the…
-
0
votes3
answers626
viewsHow to use Lambda expression in List<List<Object>?
Good afternoon I am developing an application, which returns a list list of note items, however, I need to fill some fields with the values of each list of items at a time, however, I am not able to…
c#asked 7 years, 9 months ago Diego Farias 909 -
0
votes1
answer55
viewsChange object data that is in a list
In my application, there is a chained list of elements. I need to perform an operation to change a data of the chosen element. The question is: can I do in this way as I did below searching for the…
-
0
votes2
answers471
viewsHow to leave the json of two or more object classes on the same level in Asp.Net MVC
I have 3 classes being Contact, Sector, Unit so I have Contact with one to many relationship with Sector and Unit generating Json with many layers, making it impossible for Jquery Bootgrid to access…
-
0
votes2
answers243
viewsConvert VB code to C# which turns characters into numbers
I have this code in VB and need to convert to C#. Public Function eNumero(s As String) As Boolean If s = "" Then eNumero = False Else eNumero = Asc(s) >= Asc("0") And Asc(s) <= Asc("9") End If…
-
0
votes1
answer62
viewsConsult in 2 table
I do not know how to consult in two tables of the same bank. tb_chamados id = 1 | 2 fkidempresa = 47 | 33 resumo = descrição do chamado | descrição do chamado tb_empresas id = 47 | 33 nome = Nome da…
-
0
votes1
answer207
viewsExpire Mysql user time
I’m making a system of login in C# where the login user will be verified his login, password and the time left to use the system. Until the login and password check part I managed to do, but I’m…
-
0
votes2
answers150
viewsValidation when editing existing registration?
I have the following problem: I am touching the part of controller of my system on the part of editing registrations and it does the following check, if I enter an existing code, it displays a…