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
votes1
answer105
viewsDispose in Unit Of Work
I have a web application and am using repository* and Unit Of Work. In some examples I saw that after performing some change operation in the bank we should call the method Dispose(). I instancei…
-
-1
votes1
answer56
viewsGridpanel Checkboxselectionmodel - Sum selection (ext.net)
How can I add a particular column q this selected, via java-script? I am using ext.net. <script> var sumCheck= function () { var resultSum; /* todo loop selectedrows resultSum +=…
-
-1
votes2
answers198
viewsHow to walk a C#class?
I have the DeserializeObject that fills in an order class and items, on the items I need to go through this class to record the data, the way I’m doing is zeroing the records, how I could read the…
-
-1
votes4
answers288
viewsError with vectors c# / {"Object reference not defined for an instance of an object." }
Friends I’m coming in php and starting developing in C#. The differences are many the ideas I have, when I apply they give errors, as the problem I have a combobox html that filled dynamically with…
c#asked 6 years, 11 months ago hyperpixel 389 -
-1
votes1
answer1913
viewsC# Read balance weight Toledo Prix PS 600 line
Hi, I’m trying to get the weight of a Toledo Model PS 600 scale. I used the example of the link below to carry out the communication: rnmioshi Oil Github So far I can capture the COM port where the…
-
-1
votes1
answer201
viewsExtension method(Wait() and Status()) does not work
This is not working(just the Wait() and Status lines()) try { string url = $"http://localhost:2710/api/faturamento/{IdUsuario}/{IdGaragem}"; var uri = string.Format(url); var response = await…
-
-1
votes1
answer140
viewsValidate the contents of a Datagridview cell
I need a help. I’m inserting items into an order using a Datagridview, in that Datagridview got the spine code, description, lot and qtda. I need to validate the column code, making sure that if I…
c#asked 6 years, 10 months ago Junior Guerreiro 617 -
-1
votes1
answer455
viewsHow to get just a part of a directory name?
Hello, I’m making an application to locate a file in a directory and save it to the bank as well as save tbm to the PATH. But I need to save only the name of the directories that it is, without…
-
-1
votes1
answer37
viewsFlag environment when sending email to user
Guys, I need your help. Each form that is registered in my system it sends in e-mail to some people warning that it has been registered, except that I have two environments, one of homologation and…
-
-1
votes1
answer72
viewsHTML vs markup auxiliaries
Apparently HTML and markup helpers can perform the same functions, like this example I found in microsoft documentation: HTML auxiliaries @using (Html.BeginForm("Register", "Account",…
-
-1
votes1
answer57
viewsHow to do this in LINQ?
I spent the day looking for how LINQ works and tried to use in a little project I’m using to study, after a long time trying the code using LINQ became like this: for (var dia = comeco.Date;…
c#asked 6 years, 10 months ago Pedro Santos 141 -
-1
votes1
answer237
viewsChange expression color starting with@
I need to create a winform to change the color of expressions that start with '@'. For example: nothing @expresso nada The @expression needs to be another color. The text will come from the input of…
-
-1
votes1
answer427
viewsDecimal type field Entity Framework ASP.NET MVC
I have a table called Pecas where only has name and value, but when I click create new piece is not saving in the database, appears the msg that was added but is not entering, in debug shows the…
-
-1
votes1
answer117
viewsLoad image dynamically into a grid?
I have this shampoo: <StackLayout Spacing="10" Padding="10" VerticalOptions="Center" Grid.Row="3" Grid.Column="1" > <Image x:Name="MyImage" Source="{local:ImageResource…
-
-1
votes1
answer1906
viewsError: The model item passed into the Dictionary is of type X but this Dictionary requires a model item of type Y
Error starting query and generating list with results: Error: System.Invalidoperationexception: The model item passed into the Dictionary is of type…
-
-1
votes1
answer250
viewsReplacing the csproj is a problem?
For the second time, man .csproj.user was detonated. I don’t know why this has happened or what can influence this file. Well, this is a new project I did, using the .Net Standard. When I open the…
-
-1
votes1
answer68
viewsStrange error on Xlworkbook line
Personal I appeared this message in my code that I am posting in the image, someone can help me in search of a solution; Follows the code: protected void importar_Click(object sender, EventArgs e) {…
-
-1
votes1
answer438
viewsDistributed Calculator - UDP Client/Server
I am trying to make a distributed calculator using Client and UDP Server, the client sends 3 numbers to the server. The 1st option would be chosen, example (1 - sum, 2 - subtraction, 3 - division)…
-
-1
votes1
answer36
viewsDoubt in the storage of variables
I’m a beginner in C#, and I’m trying to save the values typed in a toolbox within the property of a Classe, but the code does not compile. Could someone help me? Form: namespace ProgramPrestServico…
-
-1
votes1
answer79
viewsLinq to Entities - Count elements of a query referencing two contexts
I have the following query: var query = (from q1 in query1 join q2 in query1 on q1.idGenerico equals q2.idGenerico into q2Left from q2 in q2Left.DefaultIfEmpty() join q3 in query3 on q2.idGenerico…
-
-1
votes1
answer456
viewsTraverse attributes of an object that is in a list in C#
Good night, I need help please. I am writing a program that reads a file. For each line of the file an object is created. Each object is stored in a list. My intention is, when loading the initial…
-
-1
votes1
answer96
viewsIs Dataannotation compatible with Json?
Hello! I would like to know if Dataannotation is compatible with Json, because I am validating a form and I would like to ask the question. I am using Angular on the front and returning my object in…
-
-1
votes1
answer140
viewsHow do I delete xml data from within the program itself?
using System; using System.IO; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Serialization;…
c#asked 6 years, 7 months ago Guilherme Espindola 1 -
-1
votes1
answer120
viewsGet month value from a list
I need the person to be able to get the information and month they want, so I need to get this information from the list and then show the license plate, date, time of entry and exit, paid amount…
-
-1
votes1
answer645
viewsSave files with the same name
The app saves photos of some parts here at the service, and we use a barcode reader that works as a keyboard, to read and save the data automatically, without the operator needing to use the mouse,…
c#asked 6 years, 7 months ago Felipe Deolindo 179 -
-1
votes2
answers78
viewsMethod without any code
Following a book, I created a project windows forms application. I put in the form one textBox and a button. In the onclick of button taken the value of textBox and the attribute to the text of…
-
-1
votes1
answer52
viewsProblem accessing concrete class methods using reference this in C#
I implemented a class Service abstract using Generics and another using EmpresaService being concrete. Every project structure for every concrete class has an abstract. My doubt seeing from the…
-
-1
votes1
answer174
viewsdoubt C# stack
Good afternoon I followed a toturial of how to make a pile https://www.youtube.com/watch?v=Jc_tqYBCXws \ https://www.youtube.com/watch?v=-FmaKIZkfw0 but my code does not execute 2 3 and 0 follow:…
c#asked 6 years, 6 months ago Pedro Sobral 19 -
-1
votes2
answers121
viewsUPDATE SQL in C# (Windows Forms)
I am trying to format a standard date as there are dates with different formats as print below. MM/dd/yyyy | dd/MM/yyyy | dd/MM/yyyy hh:MM:ss I intend to change these dates to default as dd/MM/yyyy…
-
-1
votes1
answer27
viewsdatagridview does not fill the fields (Windows Form) - C# - Visual Studio Comunnity 2015
Hello, I have a problem, I enter the following problem: When I enter the data in the datagridview it does not "pull" from the database the information to put on the screen. BD is Mysql, Localhost…
c#asked 6 years, 5 months ago Júlio Adolfo Rufino 29 -
-1
votes1
answer850
viewsPick up json from Postman and play on an object
Have POST and use the Postman to test. Mount the url and body in Postman. Now, when I test on my object on mine Controller comes NULL, and of course it’s because I didn’t do it correctly. What do I…
-
-1
votes2
answers94
viewsdoubt with Linq to sql
Guys, I got two tables, sale and blindfolds: Sale: [Table("venda")] public class VendaModel { [Key] [Required] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int id_venda { get; set; }…
-
-1
votes1
answer117
viewsWrite a line in text file without using repeat instruction, is it possible?
I need to write a text file from a Dataset in C#, so it will look like: string[] lines = {"First line", "Second line", "Third Line"} using(StreamWriter outputFile = new StreamWriter(docPath)){…
-
-1
votes1
answer284
viewsVBA migration to C# - V10 (Teclapressionada)
In VBA at the event Teclapressionada would be this way. Thanks to v/ help to convert to C#. Private Sub EditorVendas_TeclaPressionada(KeyCode As Integer, Shift As Integer) Dim i As Long Dim…
-
-1
votes2
answers52
viewsFor better performance in the Postgresql database is it better to have the products divided into smaller tables?
Hello, I’m developing a system to manage the sale of several real estate developments. In this system each enterprise has a group of units available, type "Apartment 21 - 2nd Floor, Apartment 34 -…
-
-1
votes1
answer117
viewsProperty Hasrows in C#
I’m making a SELECT mysql with inner join within my application C# MySqlCommand _comandoDados = new MySqlCommand(String.Format( "select EMGroot.id, EMGroot.lbs_net, EMGroot.lbs_gross_aai,…
-
-1
votes1
answer54
viewsData is not being loaded in the Table
Good Afternoon, I wonder how I can get my list of records to be loaded into the table at the same time that the chart is loaded by AJAX, because currently in my model shows that there are records…
-
-1
votes1
answer177
viewsHow to work with various parameters in c#
Good afternoon. I need a help, I have a combobox with 3 options, and I need to pass any of the three options as a parameter of a Procedure in sql for a query, but since I’m new in c# I never passed…
c#asked 6 years, 3 months ago Junior Guerreiro 617 -
-1
votes2
answers273
viewsHow to make an if-type validation in a set of options?
I need to make a if where I check a set of options not to do a if within another if to check whether a field is filled or not, I want to do this with a single if. Ex if(valr1, valor2, valor3 != "")…
c#asked 6 years, 3 months ago Junior Guerreiro 617 -
-1
votes3
answers299
viewsHow to get the amount of "true"?
Follows code: int total_true = ctx .MinhaTabela .Where(x => x.id == 5) .Select(x => new Tabela_DTO { Campo1 = x.Campo1, // database está como true Campo2 = x.Campo2, //database está como false…
-
-1
votes1
answer195
viewsError using Dynamic in C#
I made an application in C# and to integrate with ERP Spring and passed the engine in VBA through the following line. void IPublicMethods.UpdateCDU_IfItemSelected(ref dynamic doc, string artigo, int…
c#asked 6 years, 3 months ago acamiloMoz 69 -
-1
votes2
answers177
views -
-1
votes1
answer1966
viewsHow to consume web service XML SOAP https with C# . Net Core 2.0?
I referenced the WSDL by WCF from Visual Studio 2007, and created a simple class to test the communication, I can’t understand what’s wrong, I get the error : "Could not Establish trust Relationship…
c#asked 6 years, 3 months ago Luciano Castilho 11 -
-1
votes1
answer35
viewsShow a fk name on the grid
This is the select of my proc select f.id ,f.nome ,f.dataNascimento ,f.cpf ,f.cidade ,c.nome from funcionarios f inner join cidade c on f.cidade = c.id and my model cidae is like this public class…
-
-1
votes1
answer48
viewsEdit screen does not load data on screen
When entering edit mode, the Dits should be filled in and only the city dropdownlist comes. See cshtml below. @model TreinamentoCrud.FuncViewModel.FuncionarioViewModel @{ ViewBag.Title = "EditVM"; }…
-
-1
votes1
answer449
viewsIIS Windows Server, Error running application (HTTP 403.14 - Forbidden)
I’m having a problem with running my app. My application is all done in Asp.Net MVC, using the 4.6.1 framework. I published it on the server, but when running the application, error appears HTTP…
-
-1
votes1
answer109
viewsChange date display format in View
I have the following field that returns me the date as follows: 09/17/2018 11:52 AM How to put it inside the standard en. I have tried to put the .ToString("dd/MM//yyyy") in the model.dtProtoclo but…
-
-1
votes3
answers121
viewsDataannotations problem in string fields[]
I need help validating a field string[], because whenever I send this empty field, it returns error, even if it is in the correct format: This is the field:…
-
-1
votes1
answer44
viewsQuery javascript in the Asp.net controller
I need to make a query on a method of API (Javascript) of google maps, however by controller, it is possible ? I have a requisition ajax that mounts a grid and within it I make a query in the table…
-
-1
votes1
answer65
viewsReplace text from a textbox when the user input the same textbox
I have a textbox where, through another page I pass you an e-mail. txtemail.text = "[email protected]" And when my page makes the load, in that textbox appears: [email protected]. Only if I try to make a…