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
answer73
viewsHow to Perform Label Visibility Binding according to the size of a List
I have a list of objects of type "Basicvariable", a ObservableCollection of them, and I need the Graphical Interface to display a Label when the number of items in this Collection exceeds 1000, I…
-
1
votes1
answer110
viewsSystem.Data.Entity.Infrastructure.Dbupdateconcurrencyexception error while updating with Entity
Good morning. I need to do an update via Entity and it accuses me of the following error: System.Data.Entity.Infrastructure.DbUpdateConcurrencyException: 'Store update, insert, or delete statement…
-
1
votes0
answers289
viewsScan Excel table data and save to SQL Server (Asp.Net MVC 5 C#)
I have an input file that the user will upload the spreadsheet, I need to check if it is .xlsx or .xls and scan the data from this spreadsheet. After that, I need to save to Sql server those items.…
-
1
votes1
answer82
viewsRelationship 1x1(or not)
I have 2 entities: Itempedido and Product... Using the Fluent API as I say to my Itempedido entity that she has a Product? Note: The product entity cannot have dependencies, although 1 product can…
c# entity-framework entity-framework-6 relationshipasked 6 years, 3 months ago Márcio Sebastião 769 -
1
votes1
answer64
viewsMap windows Forms controls
I am developing an application descktop in c# The framework 4.5 I did not imagine that the application could grow and have many fields, with this came the need to make an automatic mapping (from /…
-
1
votes0
answers77
viewsObject comes null in query, even if existing
I have this method in my controller [HttpDelete] public HttpResponseMessage DeletaCidade(int id) { Cidade cidade = banco.Cidades.Find(id); if (cidade == null) { return…
-
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
votes0
answers147
viewsI am having a problem consuming Cielo’s webservice. Cielo’s server https://ecommerce.cielo.com.br/servicos/ecommwsec.do
until two weeks ago the application was working normally and then stopped working by presenting the following error: "The request was cancelled: Could not create a secure channel for SSL/TLS". I…
-
1
votes1
answer218
viewsPass object to proc sql server
Is there any way I can make a SP that receives an object? This is my SP ALTER PROCEDURE [dbo].[sp_alt_funcionarios] -- Add the parameters for the stored procedure here ( @id int, @nome varchar(60)…
-
1
votes1
answer674
viewsASP.NET MVC Pagedlistpager pagination with more than one parameter
I have the following page using x.Pagedlist @using AspNet.Models; @using X.PagedList.Mvc @{ ViewBag.Title = "Visualiza"; @model X.PagedList.IPagedList<AspNet.Models.Pessoa> } <h2>Pessoas…
-
1
votes2
answers121
viewsProblems with values passed to Static variables with class on the server
Good morning, everyone. I am currently suffering from a problem and cannot find the solution. I have a login system in ASP.NET C# when I do the authentication everything happens correctly only that…
-
1
votes0
answers112
viewsUpload Datagridview photo and move to picturebox C#
Guys with little difficulty in picking up my registered photo and show it in Picturebox My scenario is this:: I have a registration form that makes the insertion of data and A form that searches the…
-
1
votes2
answers586
viewsWrite checkbox value to sql server database
I have a DataGridView and in it contains a checkbox, I need to save the value in the database, how can I do the Insert of this value in the bank, the field in the bank is as: 0=false e 1=true, Only…
-
1
votes2
answers103
viewsTransforms string to decimal within an object
I made a Viewmodel, where in the database the CPF field is decimal(11.0) and in the VM I put as String. In my API the CPF is decimal. Well, when I fill out the field and send the form to the API,…
-
1
votes0
answers168
viewsEntity Framework Conflicting changes to the role of the Relationship have been Detected
I have two objects that use a third in common and I have a problem in routine: 1) Creating a New Manufacturer var fab = new Fabricante(); DBSet.Add(fab) //Sem SaveChanges Then searching for the…
-
1
votes1
answer59
viewsHow to get the Controller to pick up the "Linktext string" text from @Html.Actionlink
In my application arose the need to make a same Controller call Sort has the Reclassification function, with this, I want the ControllerClassificar get the string LinkText of @Html.ActionLink to be…
-
1
votes2
answers137
viewsShow Groupby List using Lambda in view. ASP.NET MVC
Well, I’m having a little bit of a problem here. I consult at the bank using Lambda, and use the tag GroupBy,query is bringing objects correctly, the problem, is that I can’t show in view. gives an…
-
1
votes0
answers264
viewsSHA256 standard eSocial vs. Framework . Net subscription 4.6
Good morning, everyone, I have an application developed in C#, installed in several clients. I developed the code snippet below for SHA256 signature and works perfectly in the most modern . NET…
-
1
votes2
answers2847
viewsSEFAZ - Nfedistribuicaodfe - c# - Console Application
I already inform that I do not understand much of SOAP or XML and I’m only posting the question before studying a lot, because I’m on a very tight deadline. I need to make an appointment at SEFAZ on…
-
1
votes1
answer65
viewsHow to set a photo upload as a must
I am developing a page, for job applicants can enter and fill your personal information, one of these information is the photo, which has to be mandatory. So I created the following model: { . .…
-
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
answers48
viewsConversion error in the array of a . csv file to a datatable
I’m trying to pass the data from a file. csv to a datatable and the code seems to be all ok but I’ve been back from this error for quite some time and don’t know how to fix it. I have two columns in…
-
1
votes0
answers13
viewsChanging the Source of a Listview that was created in Fragment
Where I change the font type and color in Listview control? Listview controls are in main.xaml as below: <ListView android:id="@+id/left_drawer" android:layout_width="240dp"…
-
1
votes0
answers38
viewsProblem accessing the Controller
Apicontroller [Produces("application/json")] [Route("api/[controller]")] public class ClienteController : Controller { private IClienteRepository _ClienteRepository; public…
-
1
votes1
answer27
viewsProblem with Reading Attribute in c#
I have the following problem, I have my ENUM class: public enum DataBaseType { DATA_BASE_NAME, SERVER_IP_NAME, PORT, USER_NAME, PASSWORD }; I have my Attributo, in which you have this ENUM: public…
-
1
votes1
answer47
viewsOrderly list return at BLL?
In my project I use the EF6, use generic repositories and in my layer BLL I have the class ClienteBLL, which is a class that has the logical implementation methods of the class. In one of the…
-
1
votes1
answer345
viewsUse c# to install a program in silent mode by passing parameters
I am trying to create a program that installs several programs silently some programs that use simple parameters type " /Q" I got and worked but it has a program that the parameter is big and they…
c#asked 6 years, 3 months ago Fabyo Guimaraes 58 -
1
votes1
answer198
viewsGenerate Pdf via ajax.POST with Rotary
I want to generate a. pdf file using Rotary, my ajax call is as follows: $.ajax({ type: "POST", url: "Home/Index", data: { nome: inputName, laudos: laudos, imagem: imgSelecionada }, }); And the code…
-
1
votes0
answers115
viewsJumping id 1000 Sql server 2014 (localDB)
In my application a few times when I will add some data to the database the ID jumps in 1000 drives. I found some solutions, but they are not good for me because I use EF6 with code-first and my…
-
1
votes0
answers32
viewsUpdate field value Using Tableadapt C#
Nostalgia! I am working with Dataset to modify data in BD sql. I have a Tableadapter allocated to a form where some of the fields are linked to textboxes. It turns out that some of the fields I…
c#asked 6 years, 3 months ago Virgilio Cossa 11 -
1
votes1
answer47
viewsWPF C# Current position of Mdichild?
I have implemented a MDIParent with 3 children. I want to know where the children are but I have no access to any property since: child.position is always (0,0). shaman I have: <mdi:MdiContainer…
-
1
votes1
answer40
viewsI need the name of the package to appear in the history table but the id_package is appearing
public List<HistoricoViagem> ObterTodosParaJSON(string start, string length) { List<HistoricoViagem> historicoViagens = new List<HistoricoViagem>(); SqlCommand command = new…
-
1
votes1
answer79
viewsPHP and C#communication error
I’m trying to send a C# data to PHP, but the example I find and all solutions simply result in the same error. using System.Net; using System.Collections.Specialized; string valor = "1"; string…
-
1
votes1
answer42
viewsRandom on the switch statement, why doesn’t it work?
Following the code below, my intention was to randomize the switch to choose between case 1 and 2, after receiving the word "Gamble". It turns out that when I write Gamble, only case 1 is activated…
-
1
votes1
answer516
viewsPassing Date parameters for queries
I am having a problem when passing a parameter. I tried to debug by passing the Date as `string, but the problem arises that one expects a number instead of a character. After that I searched other…
-
1
votes0
answers49
viewsHow to Remove Chunk of Code using Find and Replace from Visual Studio with Regular Expression?
I’m with a c# application that we’re looking to remove code snippets. One of the situations I have several If/E-s, where Else doesn’t make sense. Type like this (as an example): var entidades=…
-
1
votes1
answer67
viewsPrint whenever variable receives a certain value
I am developing a simple game in which whenever an object exits the screen a variable of name score gets +1. The idea is simple, what I am trying to do is to print the value of the variable score…
-
1
votes1
answer56
viewsC# - EF Core doubts to create relational model
I am starting in Asp Net Core and have the following question: I own a model Curso and a model Unidade, a course has several units and that unit may belong to more than one course. I made the…
-
1
votes0
answers813
viewsHow to pass an object as a parameter to another class method
I am developing an object-oriented agenda and recording in a text file. I’m finding the following problem: when saved a contact it is passing to another object as if it were a pointer using System;…
c#asked 6 years, 2 months ago Lucio Donati 21 -
1
votes1
answer635
viewsType 'http://www.portalfiscal.inf.br/nfe:Tnfe' is not declared
Good morning, usually I avoid to the maximum to ask questions here in the forum because I always find many answers that supply my situation. I am doing an integration with Sefaz, using Ws Nfe 4.00…
-
1
votes1
answer98
viewsGenerating an xlsx file from a Gridview that is powered by a Database
Good afternoon, I am facing a problem when it comes to generating an Excel file, I was able to make the information appear in Excel and be shown on the screen, but found me with doubt when I try to…
-
1
votes0
answers96
viewsInaccessible link on IIS
I’m making a C# application using the MVC standard. It uses a Google Firebase database. Running this application by Visual Studio debugger works normally, but when trying to publish it in localhost,…
-
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
votes0
answers54
views"Could not parse Expression '...: The Given Arguments Did not match the expected Arguments"
I am using the Compiledqueries Feature of the framewok core 2.0 Entity but Even though it does not Give syntax error, when the program is running, I get this Exception: Could not parse Expression…
c# asp.net asp.net-core entity-framework-core .net-coreasked 6 years, 2 months ago Samuel Silva De Carvalho 11 -
1
votes0
answers258
viewsLocal connection Sql Server Express 2017 - Asp.Net MVC
I’m trying to connect in Sql Server Express 2017 via Visual Studio (local connection), but keeps returning me this error always when you try to open: A connection to the server was successfully…
-
1
votes0
answers21
viewsHow to integrate a Class Library to a Database Project in Visual Studio
Hello, I am creating a solution in Visual Studio in which I would like to separate all layers of the application in projects to have a better defined structuring. My solution until then is like…
-
1
votes0
answers108
viewsError accessing this.Documentpending property Type
I would appreciate possible help to overcome the mistake: this.DocumentPendente.Typentity = 'This.DocumentPendente.Typology' generated an exception of the type…
-
1
votes0
answers506
viewsPrompt + EXE Server IIS execution by WEB page
I am running a command of an executable by the CMD of the Blue Prism software, I tested local and it worked, but I have a question for when I go up in production, because the IIS server will have…
-
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
votes0
answers36
viewsCode-based configuration - EF6
I’ve been trying for a few days to implement a connection to an Oracle 11g database using the EF6 code-based configuration, but nothing I’ve done so far seems to work. Currently this is my…