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
answer72
viewsHow to add a background with C#codes?
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Wellsoft{ class Program { static void Main(string[] args) {…
c#asked 6 years, 1 month ago Gabriel Ferreira 11 -
-1
votes1
answer452
viewsC#hash encryption
I was able to create a registration with an encrypted password, but in the access method (login) I have doubts on how to take the password typed and compare with the password registered with…
-
-1
votes2
answers131
viewsSyntax error in sql command
I have a possible problem in sql syntax in my code if (tbCPF.Text != "" && tbNome.Text != "" && tbEndereco.Text != "" && tbNumero.Text != "" && tbBairro.Text != ""…
-
-1
votes1
answer63
viewsC# Method and variable call
I am making a wish in c#, I made the methods of questions but when it comes to checking the correct alternatives is not recording the score in the variable points, what I am doing wrong? using…
c#asked 6 years ago Vitoria Vicentin 3 -
-1
votes2
answers124
viewsHow to verify that the email is already registered in the database?
The Controller is always returning the error message, when the email is registered or not in the database. [HttpPost] [ValidateAntiForgeryToken] public ActionResult Create([Bind(Include =…
-
-1
votes1
answer31
viewsError calling method in code Behind
using System; using Treinamento.DTO.Global; using Treinamento.BLL; namespace Treinamento.WEB.Tabelas.cidade { public partial class Listar : System.Web.UI.Page { protected void Page_Load(object…
-
-1
votes1
answer24
viewsError in Unity3d
How can I fix this error? I found nothing about it on the internet... this is the script `using Unityengine; using Unityengine.AI; public class Bluecubebehaviour : Monobehaviour { private Rigidbody…
-
-1
votes2
answers94
viewsWhat is the best way to add a static method to an existing class in C#?
I’m creating an app restfull using the library Newtonsoft to send information through controllers. In my application, I have numerous classes such as user: public class UsuarioModel { public int Id…
-
-1
votes2
answers114
viewsdoubt to consume api
I have the following service: [HttpGet] [Route("save")] public async Task<dynamic> save(VendaModel[] venda, string CnpjEstab) { dynamic retorno = null; VendaModel ultima = new VendaModel();…
-
-1
votes1
answer74
views -
-1
votes2
answers82
viewsCreate an object reference in your own method
Problem I want to get the last digits of this string, then I used the method Substring(), however I had to use the variable "number" again within the method Substring(). string numero = "123456789";…
-
-1
votes1
answer40
viewsUndefined object reference for an instance of an object c#
Good afternoon guys. I’m having a really hard time solving a coding problem. When I perform a INSERT, displays an object reference error not defined in the row leitora.Tecnico.IdTecnico. Could…
-
-1
votes1
answer77
viewsHow to create Oauth2 Rediret URI using Dropbox API in C#?
I’m having trouble connecting to DropBox using a Console Application of C# and tried to create a Redirect URIs in my profile app on the website of Dropbox, but I don’t understand much. In my app, I…
-
-1
votes1
answer131
viewsPEC inclusion of Caixa Economia
Good afternoon, I have the following problem. The mistake : soapenv:Serverthe Operation could not be found. The endpoint Reference (EPR) for the Operation not found is:…
c#asked 5 years, 11 months ago Leandro Bianch 3 -
-1
votes2
answers95
viewsRead contents of ZIP file without writing to disk
In the program I am writing I download a ZIP file over the internet and then need to upload the files extracted from ZIP to another place. Turns out I can’t find a way to read the contents of that…
-
-1
votes2
answers68
viewsShow how much it costs in total
A program in Windows Form that I am creating , I want to click on the check of the chosen foods the full bar should show how much is getting, but always appears blank what should I do? Follow the…
-
-1
votes1
answer90
viewsC# Selenium enter menu
I am automating access to a site, it opens browser, logs in, goes to a certain page and after that, a drop-down list appears to choose "Category" Inside this drop-down list, I have 3 items only, it…
-
-1
votes3
answers299
viewsHow to make Visual Studio interpret an hour that is larger than 23hrs and smaller than 6hrs at the same time?
I have a function that is called and must enter the condition where the time now is greater than 23 hours and less than 6 hours at the same time, however the code conflicts with this condition and…
-
-1
votes1
answer54
viewsConvert odt to pdf
I need to convert files from the .ODT for .PDF, if I run the following command in cmd it works: cd C:\Program Files\LibreOffice\program> soffice.exe --headless --convert-to pdf --outdir C:\temp\…
-
-1
votes1
answer75
viewsActivation of the Save c#/wpf button
How can I make sure that once there is a change in the text field, the save button is enabled? or by clicking edit (thus creating the button) the app enables editing and thus enabling the button…
-
-1
votes2
answers58
viewsDoubt about the Context Class
In my system I have class Context to make the connection with the Bank, through the Entity Framework and I have a doubt, I should only use the public DbSet<NomedaClasse> Classe {get; set;} if…
-
-1
votes1
answer484
viewsHttp Request, with Certificate X509
Good morning, By accessing the following link :…
-
-1
votes1
answer35
viewsHow to get the listed network drive name
I’m listing my network units via C# in a TreeView. Today it is appearing as follows: But I want the full name to appear: C:\Disco Local J:\Pen Drive X I’m using the following code to fetch the…
-
-1
votes1
answer45
viewsServer.Mappath does not find the folder in my project
I am trying to save a file to a folder in my project (In case in Files folder): but gives the following error when entering the action: Controller Code: [HttpPost] [ValidateAntiForgeryToken] public…
-
-1
votes1
answer38
viewsDo not page the list of Products
I don’t know anything about Razor or Webmatrix. I took a project already done by another developer and I came across two problems, I can not locate where the SQL queries to list the products and…
-
-1
votes1
answer184
viewsHow to configure the credentials of a webRequest?
How do I perform an ASP NET MVC 5 request in this way: Method = post; Authentication credentials = xxx:yyyyy (i.e., username, followed by two points, followed by password, encrypted in Base64…
-
-1
votes2
answers56
viewsUpdate quantity in a table with sql server and c#
I have a datagridview that is filled as soon as I choose the items that in the case are products that contain quantity in the product insert I choose a quantity and add the item to datagridview,…
-
-1
votes1
answer133
viewsImage (BITMAP) for String
I have never worked with anything like this and would like to insert an image into a database and for what I saw the best way is to transform an image into a string, I have searched and found some…
-
-1
votes2
answers190
viewsKeyboard events in C# in textbox
Hi, guys, I’m new to C#. Well, for teaching purposes, I’m developing this calculator that you see in the image. It is almost ready, however, it only lacks the function of when I type a number of the…
-
-1
votes1
answer36
viewsHow To Make My Save, Change My Database Data
Guys, I’m trying to make a Button that normally Salva, also become a Button that saves the changes made... It’s all the same form and the same Button, for example when I click two DataGrid he brings…
-
-1
votes1
answer89
viewsHow to browse a Viewbag and popular a cshtml table
This is my Viewbag public ActionResult Details(AzureDiscountGroupModel model) { var reseller = _resellerService.QueryAll(); ViewBag.DetailReseller = reseller.Where(x => x.AzureDiscountGroupId ==…
-
-1
votes1
answer143
viewsChanging Mysql data with C#
I am trying to change data saved in my BD, however by having a certain error, if someone can give a light code I’m using to save the changes: private void btnSalvar_Click(object sender, EventArgs e)…
-
-1
votes1
answer33
viewsHow to use Linq in 2 lists so that one complements the other in C#
Hello, I have the following situation: public class Foo { int id { get; set; } Bar bar { get; set; } } public class Bar { int id { get; set; } int FooId { get; set; } } public class Program { public…
-
-1
votes1
answer963
viewsShuffle text
insira o código aqui[![inserir a descrição da imagem aqui][1]][1] shuffle text Rules: 1. Punctuation marks are word separators, are not part of words and so are not shuffled, for example: a)…
-
-1
votes2
answers64
viewsIndex('+') works but Index('*') is not working?
The following code is a simple calculator that accepts two numbers and applies +, *, - or /. and the input of the signal + is working well: input = Console.ReadLine(); while (input.Contains("+")) {…
-
-1
votes3
answers750
viewsSQL Inner Join 3 tables
Good afternoon. I want to make an Internet but the result does not come out. Tabela1 = rec Campo = chvbfj(3) <- codigo do cliente Tabela1 = rec Campo = doc(3,4,5) <- lista de codigos de itens…
-
-1
votes1
answer61
viewsError in dependencies
Hello, I’m starting to develop a web application with . Net CORE. have installed the . Net Core SDK 2.2.103 and when I open my project, I have some errors in the dependencies as shown below: This is…
-
-1
votes1
answer144
viewsPrivate unit attribute test of a class / C#
I’m trying to create a unit test to ensure that an attribute of an X class is actually changed. But to compare it at the end of my test, something like: Assert.Equal(_sampleClass.Email, mockEmail);…
-
-1
votes1
answer83
viewsReturn parameters from another form via click
I’m playing a poker game in C#, but I’m not able to establish a communication between 2 Forms, so the formPrincipal receives values from formSecundario, using the player class that exists in…
c#asked 5 years, 6 months ago Eduardo Maciel 5 -
-1
votes1
answer124
viewsI cannot perform a Redirecttoaction for an Area
Print of what I’ve accomplished, but it didn’t work, this is my Logincontroller. My structure, and I’m trying to point to the Patientecontroller/Index: One of the other options I tried was to add…
-
-1
votes2
answers58
viewsObject Reference not set to an instance of Object
Good evening, I’m trying to take a function that be in another script and pass it to a button, only to be giving this error that be in the title. int indice; public Button Ant; public ScriptName…
-
-1
votes1
answer79
viewsHow to close an Excel application in C #
I have this c# function that converts an excel file into another excel format, the problem is that when the application runs it does not end with the _app quit function.(); The excel application is…
-
-1
votes1
answer33
viewsI can only output a database record. How do I output all the records I have in the database?
public ActionResult Index() { PAPEntities db = new PAPEntities(); MoviesData movie = db.MoviesData.SingleOrDefault(x => x.MovieID == 1); List<MovieViewModels> MovieVM = new…
-
-1
votes1
answer38
viewsCamouflage Sender using Smtpclient
Eae you guys, beauty? I am making a very simple email Nder, but I found myself in a question that I can not solve... My first idea was to get a temporary email address to use as a Sender... But…
-
-1
votes1
answer53
viewsHow to create a list or dictionary from a datatable?
I have 3 lines in a datatable: DataTable dt = new DataTable(); dt.Clear(); dt.Columns.Add("PESO"); dt.Columns.Add("ALTURA"); DataRow row1 = dt.NewRow(); row1["PESO"] = "MAGRO"; row1["ALTURA"] =…
c#asked 5 years, 6 months ago Renzo Rodrigues 387 -
-1
votes2
answers92
viewsconverts from Vb to c#
I have this code in Vb, I need it in c#. In Vb create a new code each time it is executed, in c# always puts the same code "000011". Public Function CalculaNovoCodBarras() As String Dim lista As New…
-
-1
votes2
answers375
viewsCalling another class method in a Task c#
I’m trying to make a task call from a method of another Class: Diretorios diretorios = new Diretorios(); await Task.Run(() => diretorios.CopiaDiretorios(tbxVersaoAtual.Text,…
-
-1
votes1
answer52
viewsDate Input returning Time along with date
Example: I’d like you to return only to Data, but I don’t know what to do! My code: [Display(Name = "Data de Nascimento")] //[DataType(DataType.Date)] //[DisplayFormat(ApplyFormatInEditMode = true,…
-
-1
votes1
answer155
viewsJson does not exist in the namespace *using System.Runtime.Serialization.Json*
An error occurred while trying to import using System.Runtime.Serialization.Json. How to solve? The code converts Json to Object and vice versa, I’m only posting a part of it. using System.Text;…
-
-1
votes1
answer74
viewsHow to simulate the click of a button with httpWebRequest
This code of mine takes an entire content specific to a site How to simulate the click of a button? [Route("HomeController/Requisicao")] // Matches 'Products/Index' public string Requisicao() { var…