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
answer61
viewsReceiving Request in View
Hello! I am trying to receive a filter parameter in my view with the following code on Controller: public ActionResult Cadastro(int? idParente) { var tab_Documentos_Parente =…
-
1
votes1
answer82
viewsPopular Listview UWP C#
I’m using a bank in sqlite, already done and with data in my application UWP and trying to display in a listview the data in the table Marcas. What I’ve done so far is create a class Marcas: public…
-
1
votes1
answer136
viewsFile closure
I need to leave the file free, without getting in use, because it is blocking. Follow the code: StringWriter sw = new StringWriter(); XmlTextWriter tw = new XmlTextWriter(sw);…
-
1
votes1
answer82
viewsField validation via jQuery correctly
I have the following validation for the TextBox justification. But even returning the message and clicking the OK button the system validates the deletion. The right, should return the message and…
-
1
votes2
answers371
viewsSending email C# The remote name could not be resolved
I’m testing the email sending of the application for a password recovery option,I tested several ways, including email from another domain and hosting and everything works well, tested with gmail…
-
1
votes3
answers68
viewsError in if ultimalization
My intention with this code is to show how many numbers are odd and how many are even. (e.g. Odd: 3 Even: 2). for (int i = 0; i < 6;i++) { int SePar, SeImpar, cont; SePar = 0; SeImpar = 0; cont =…
c#asked 7 years, 3 months ago Luizz Filipe 15 -
1
votes0
answers252
viewsIf or Try/Catch?
here at work I came across a code that deals error in an if instead of Try/Catch. The programmer justifies that the catch interrupts the code, but I believe that a Finally ensures the execution. Can…
-
1
votes1
answer40
viewsBackup Database - error in SQL Syntax
I am building a button to make a backup of mine dbvia application C#, everything is going well, but at the time of applying the Executenonquery is accusing error of syntax. Follows: Designate Path:…
-
1
votes0
answers84
viewsdmColor and dmDuplex values of the DEVMODE structure always returning 0
I am doing a C# printing monitoring job and using the winspool API. I was able to capture much of the data I need, such as number of pages, printed document, number of printed pages, user who…
-
1
votes1
answer80
viewsOpen Program with dragging file(PDF) and even recover the path
Hello, I am with a little complicated need, I am developing an application that sends pdf files to an application via webservices. I just want to let this problem begin in a few different ways. I…
c# winforms visual-studio visual-studio-2013 drag-n-dropasked 7 years, 3 months ago Renan Silveira 376 -
1
votes1
answer83
viewsApplication continues to be executed even after closure
I’m having a problem with my application. The same continues in the list of processes even after its completion, besides it, also appears in the list the application Clickonce. Setting My…
-
1
votes2
answers137
viewsProperty error cannot be set to System.Double
I took that mistake: The 'Datalib' Property on 'Release' could not be set to a 'System.Double' value. You must set this Property to a non-null value of type 'System.Single' The thing is that I…
-
1
votes1
answer45
viewscustom rangeValidation
How to make a Validator range where Max is the current year + 1 ? I’m wanting to do a validation in dataannotation on my models I want to do a validation range from 1950 to current year +1 By…
-
1
votes2
answers84
viewsError while trying to deserialize JSON from a web page
I’m using Luis.ai to create my neural network of intents and Microsoft Bot Framework to create my chatbot, but I’m not able to read a json that luis is generating for me. Luis' class: public static…
-
1
votes1
answer410
viewsDisplay saved image in database and allow user to change image
I am retrieving the database information and checking whether the GIF and Image fields are null or not to display to the user the best option in View Edit. Anyway, follow the code where I do this…
-
1
votes1
answer358
viewsHow to log a post into a web api
I want to know what the Web Api is receiving in the Post that I am sending. This is the code I’m using. var httpWebRequest =…
-
1
votes1
answer169
viewsHow to leave the position of a fixed div according to the Raddiobutton change
I have the following screen that once changes the option of RaddioButton to div goes down or up. I wonder how to leave fixed in a position. Selected the Cycle option: Selecting the Year option:…
-
1
votes1
answer80
viewsError trying to log in with mysql
I am trying to log a user to my system using a Mysql database, but it is returning me a Nullreference error. I tried to check if it was null before converting to string, but the error persists. Why…
-
1
votes1
answer1338
viewsAsynchronous module or handler completed while asynchronous operation was pending
I am trying to send an email asynchronously, without waiting for the return. However when I do not use the await I get an exception in return for action. Code: public Task MissaoAvaliada(string…
-
1
votes1
answer159
viewsProblem saving Combobox data to Postgresql
First this is the bank code I’m using: CREATE TABLE perguntas ( cod_pergunta SERIAL PRIMARY KEY NOT NULL, pergunta VARCHAR(500), opcao_um VARCHAR(500), opcao_dois VARCHAR(500), opcao_tres…
-
1
votes1
answer1082
viewsCheck items registered in the checkedlistbox
I am programming in C# in Visual Studio 2015, and I have a form with a checkedListBox with names of several courses (The registration is a student). When marking and saving, it saves the student’s…
-
1
votes2
answers181
viewsProblem with async task
I’m banging my head to solve but I can’t, the mistake is An asynchronous module or handler completed while an asynchronous operation was still pending. source error: An unhandled exception was…
-
1
votes2
answers56
viewsDynamically create Servicecontroller array
I would like to create a Windows service monitoring and I want to register a customizable amount of services. For this I need to have a Servicecontroller array dynamically, the problem is that of…
-
1
votes0
answers243
viewsDeclare a List<string> and display in xaml
I am trying to make a List string in Xamarin , this list auto increments according to an attribute being declared true; public bool TemPão { get; set; } public bool TemBife { get; set; } public bool…
-
1
votes0
answers70
viewsHow to get the server response efficiently?
I am creating a Client/Server application Acts as a chat so the server can send messages to the client and vise-versa. To send messages I use an event private void btnsend_Click(object sender,…
-
1
votes1
answer448
viewsHow do I profile security with Asp.Net MVC?
I am creating a system using Asp.Net MVC and before I start I need to do profile-based security. I’ll have multiple profiles each with an access option. For example: Admin Profile (access all),…
-
1
votes0
answers663
viewsAsp.net C# DDD - Implementing Web Api
I’m developing a DDD structure system with Simple Injector. When developing the WEB API, the data returned from the BD is null. In other tests performed in the MVC view, the same data is returned…
-
1
votes0
answers45
viewsMy class "Playerbehavior" is not inheriting the other class "Characterbase"
I’m not getting access to the class CharacterBase of my Script PlayerBehavior using System.Collections; using System.Collections.Generic; using UnityEngine; public enum TypeCharacter{ Priest = 0,…
-
1
votes1
answer125
viewsData Structure / List C#
The problem is: Do a function to remove the n first elements from an integer list. The function must return whether the operation was possible or not (true: it was possible, false: it was not…
c#asked 7 years, 2 months ago user89590 -
1
votes1
answer141
viewsUsing Arraylist to update the information in c# "checkedlistbox"
Fala galera to with a difficulty in picking my strings to update my information. My scenario is this: i have a checkedlistbox where I have my strings in total are 9. In the input part of the data I…
-
1
votes1
answer162
viewsAccessing Rasor variables inside a foreach
I am trying to list the contents of a table, showing in each item the items of another table that maintains a relationship with the first (1:N). For this I need 2 select, being the 2nd select based…
-
1
votes0
answers60
viewsMultiple calls to the webservice
I would like to know the best way to make N calls to the same Webservice. Ex.: In a search system / hotel quotation, as a strategy, we use N calls for a specific quote because in each call is sent a…
-
1
votes1
answer474
viewsHow to bring other columns with Groupby with LINQ
I have two tables: 1st Process containing Processoid and Situacaoprocessoid 2nd Situationthe process that contains Situationthe Process and Description Models: public class ProcessoModel { public…
-
1
votes0
answers536
viewsHow to encrypt a file using c#?
I need to create a function to encrypt files using the Caeser method without using the ready-made functions of the C#library. My code does not work for large files the computer hangs: public static…
-
1
votes1
answer108
viewsWhere Dinâmico no Linq to Entities
Expensive, I need to perform a dynamic Where, in a Linq to Entities. I researched some solutions but none could accomplish what I need. Until then, I have the following switch: public…
c#asked 7 years, 2 months ago Julio Soares 525 -
1
votes0
answers293
viewsBest practices for using Try / Catch blocs
What is the best strategy to use Try / Catch blocks: try { //FAÇA ALGO } catch(Exception ex){ //LOGAR O ERRO //LANÇAR O ERRO PARA CIMA? } Example: A tax calculation operation starts the process by…
-
1
votes1
answer869
viewsPass an object to Modal
I have a Foreach in a table, I need as soon as the user clicks on a row, open a modal with the object data contained in that row. The Foreach: @foreach (PedidoModel pedido in @Model.Entidades) {…
-
1
votes1
answer1130
viewsChange Label in view in Asp.Net MVC Project
I created a class in the Model called Payment.Cs, where it has the attributes exactly written as the name of the fields in my payment table in the BD. I created a view to register the payment…
-
1
votes1
answer614
viewsLogin with Facebook at Xamarin Forms
I am developing an App using Xamarin.Forms and I need to use the Facebook authentication system. what happens is that when I debug it I get an error message saying: Unable to load URL: The domain of…
-
1
votes1
answer1012
viewsGroup objects and add values
I have a class ListaBid with several objects, in this class there are attributes Partnumber(Chave), Quantidade and SaldoPartnumber. I can have X objects with the partnumber Y and other X objects…
-
1
votes2
answers100
viewsMy App does not load list of items
I have a App Xamarin.Formsthat consumes two services rest. The first service, consumes normally. However, the second, that I need to pass a parameter, this is not being consumed. I’ve tried several…
-
1
votes2
answers447
viewsFormatting numbers is not working
I have this line, where I need to format a field. I did several ways and nothing: lista.ForEach(e => e.Total = string.Format("{0:N}", float.Parse(e.Total))); and so lista.ForEach(e => e.Total…
-
1
votes0
answers153
viewsHow to receive Hexadecimal information via serial in C#
Better starting an application that receives via would be the data of an interface in Hexadecimal, however, when the data arrive, they are not shown in a format Hexa, it seems to me that they are…
-
1
votes1
answer37
viewsUpdate Queryexpression
I made a select to bring all entities that contain the "se_customdate" field as null. So far, no problem. However, now I need to assign the value of the variable "createdon" to the null fields, but…
-
1
votes1
answer186
views(CS0029) convert a List into Observablecollection || Sqlite
I’m trying to create a method that returns a ObservableCollection in place of a Listin the Sqlite namespace Projeto_03.DataBase { public class TarefasDataAccess { private SQLiteConnection _database;…
-
1
votes0
answers132
viewsQuery using the Entity Framework
I’m a beginner in the Entity Framework and I picked up a software for maintenance that uses the Entity. I need to create a report and do the following SQL search using Entity: select p.RA, p.Nome,…
-
1
votes1
answer502
viewsService is not being called to update the database
I did a job and when I call on URL, passing the appropriate parameters, does not work: Call on URL: http://localhost:9078/api/atualiza/1000012120/teste My service: public class AtualizaController :…
-
1
votes1
answer214
viewsCS0118 error in Unity "player is a namespace but a type has expected
Who can help me, I am in great need. It is a project for a game in Unity 2d: using System.Collections; using System.Collections.Generic; using UnityEngine; //using player ; //using Monobehaviour;…
-
1
votes1
answer183
viewsDatagridview updating by child form
I have a main form (form1) where I carry a datagridviwer and I need to do this: I have a second form (form2) deleting the selected line in datagridviwer (form1), I just need to do that when I delete…
c#asked 7 years, 2 months ago Junior Guerreiro 617 -
1
votes1
answer2023
viewsChange color line according to cell content in datagridview
I have a Windows Form that carries a DataGridView, in it has a column that contains positive and negative values, need that when the value of this column is negative the row is a different color.…
c#asked 7 years, 2 months ago Junior Guerreiro 617