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
votes2
answers158
viewsGet the name of the wifi connected in C#
Obs: Não tem muita explicação, apenas obter o nome do wifi conectado.
c#asked 6 years, 8 months ago Matheus Miranda 5,375 -
0
votes1
answer1752
viewsPerforming the Submit Form using C#
There is the following HTML login form <form action="/Home/Login?ReturnUrl=%2f" method="post"> <input name="__RequestVerificationToken" type="hidden"…
-
0
votes1
answer2333
viewsHow to capture a key pressed in C#
I have an application with digit buttons and want to capture keystrokes and run the events of these buttons. I added an event of keypress in the window and tried to capture the typed key, but could…
-
0
votes2
answers572
viewsGet value from inside a C#string
I need to take the value inside a string dynamically. The values of the string will always be in the following format: Ex1: "Aprovados por autorizantes da aplicação -> Fiscal Mestre" Ex2:…
c#asked 6 years, 8 months ago Caio Vinícius 125 -
0
votes1
answer87
viewsWhat kind of function should I use?
I’m trying to develop an application where when the value of a bool variable changes to false it must run a script. Should I use background_work to do this? If so, how should I use it? And if not,…
-
0
votes1
answer77
viewsWrite a value at a certain display position outside the form
I’m developing an application in Windows Forms, with C#. For example: I want to write a text in the youtube search field, as seen through:http://prntscr.com/ck0vo2 Can anyone tell me how to send a…
-
0
votes2
answers193
viewsFind string in html code
I need help with the following: _Add several files ( extension .htm ), approx 20 files. _Analyze and find in the 20 files a string determined in the HTML code ( maximum string length is 20…
-
0
votes1
answer421
viewsWhat is that vertical and horizontal line for when you click on the Form?
I wanted to know what that vertical and horizontal line is for when you click on the form and it is there, then dps when you click again, another line appears. And how can I get these lines?…
-
0
votes1
answer268
viewsImport HTML table based on a URL and fill a datatable
string htmlCode = ""; using (WebClient client = new WebClient()) { client.Headers.Add(HttpRequestHeader.UserAgent, "AvoidError"); htmlCode = client.DownloadString("http://www.site.html"); }…
-
0
votes2
answers1265
viewsVisual Studio copy file to output directory
Hello! In my project I have an xml file and I want to copy this file to the output directory at the time of compilation so that it stays together with the executable file and other files. For this I…
-
0
votes1
answer71
viewsIgnore property with Fluentnhibernate?
I’m trying to ignore a class property for mapping with Fluentnhibernate and I’m not getting it. I’m trying to follow this example link. How to do this ? trying to. public class Caixa { public…
-
0
votes0
answers442
viewsError the best Overload for '.ctor' does not have a Parameter named 'throwifv1schema' with Entity
I have an error that is not making me not able to compile the project. I am using Asp.net c# Entity framework code first Error indicates the best overload for '.ctor' does not have a parameter named…
-
0
votes1
answer150
viewsC# Combobox and SQL
I would like to know how to load values in a combobox, listing an entire column of the database, for example, I have a column called "Beer" and it has several names, I would like to list this column…
-
0
votes2
answers124
viewsHow to organize an Array in order of Time?
I have two lists with format TimeSpan and another with a format of String. I need to organize these two lists for increasing and decreasing. List<string> horaString = new List<string>()…
-
0
votes1
answer210
viewsAngular ng-show , does not remove C#/Angular/Javascript code
I have the following code listing categories: <div class="row" ng-show="!TemCategoria"> <div class="container" id="categoria" style="float:right" ng-hide="TemCategoria"> <select…
-
0
votes1
answer151
viewsPermissions in the Login
I’m making an application in C# where I created a database for the login system where I have the users created. In this login system I wanted to add permissions to certain users. For example, the…
-
0
votes1
answer257
viewsProblems when giving Post on a Viewmodel to the Controller - Asp.Net Core 2 MVC
I have a Viewmodel that I use to upload data from a natural or legal person. It contains some properties like Personal Properties, among others, that I use to load my dropdownlists from my view. The…
-
0
votes1
answer65
viewsProgramming a button that when clicking for the second time, the form returns to the previous position
Good staff. I have a program in C# with several formats created. Each form has Formborderstyle:None and has a button that when clicking maximizes the form. What I intend is that by clicking that…
-
0
votes1
answer607
viewsObject reference not defined for an object instance - (objects are not null)
Good afternoon, I do not understand some concepts and I have great doubt regarding this problem, I did some research to try to identify, but without success. I have this code and is returning error…
-
0
votes1
answer235
viewsASP.NET MVC - Passing data between Views
I have two tables: Tb_1 and Tb_2; both have a column id and are related to each other in a Microsoft SQL database. For example: I selected the record paragraph 2 in Tb_1. When triggering the command…
-
0
votes1
answer228
viewsSend Bad Request by REST
A method of mine takes the field value. If this field is null or zero, a Bad Request must be sent to the user indicating the field ID and stating that it cannot be null. This is a REST service. I am…
-
0
votes1
answer313
viewsRichtextbox specific line in bold
I have a Richtextbox where I need to leave the lines of positions [0] and [6] in bold. I have the following code: rtbDadosAdicionais.Select(0, rtbDadosAdicionais.Lines[0].Length);…
-
0
votes1
answer60
viewsList reservations by Administrator
I am trying to list my bookings by different administrators. However, as I did, it lists all bookings. That’s the method I’m using: public ActionResult Index() { Administrador administrador =…
-
0
votes1
answer64
viewsHow to install a Hidsharp Nuget in Visual Studio
I need to communicate between WPF I’m creating and a door USB which receives data from a hardware. Reading on, I saw that a library called Hidsharp that would be a Nuget to make this communication,…
-
0
votes0
answers47
viewsCOM component interface (Interop)
Someone could help implement Interface to create a DLL interop of that classe? using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using…
-
0
votes0
answers216
viewsDoes reportviewer display no object value?
I am trying to generate a report with Reportviewer about the items of a sale, the report is displayed but in the product column instead of appearing the product appears #Erro. My classes are all…
-
0
votes0
answers215
viewsGrab directory to save file
I am developing a system, and in this system, I submit a PDF report from some information, I would like to know, how to open a screen similar to the filedialog, but to select only the directory, so…
-
0
votes1
answer102
viewsRedirect users not indexed Asp.net
I have an Asp.net MVC page, using entityframework, and I have a login system : public ActionResult Index(LoginModel model) { if (ModelState.IsValid) { try { if (Membership.ValidateUser(model.Email,…
-
0
votes1
answer406
viewsViewbag for all Asp.Net MVC C#controllers
I have an application in ASP.Net MVC, after the user login need to show his name at the top of the page always, regardless of which page he is. This application is an administrative where will be…
-
0
votes1
answer217
viewsHow do I validate whether files in a directory are hidden or hidden?
Good morning, Everybody. There is a program that prints PDF files that are in a predefined directory. The problem was happening because there were two hidden folder files and the program was trying…
c#asked 6 years, 8 months ago Diego Farias 909 -
0
votes1
answer72
viewsEvent pressing key 2 times
I have the following event: private void TelaAcao_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue.Equals(27)) { this.Close(); } } The result is that every time I press ESC, the form is…
c#asked 6 years, 8 months ago Lucas Bustos 97 -
0
votes1
answer1089
viewsCalculate distance between two indexes of a matrix?
I want to enter two matrix indexes, and subtract that value. For example I want to enter with index [0, 1] and [2, 10]. And then I want to subtract the value, to calculate the distance I’m between…
-
0
votes1
answer102
viewsHow to hide all buttons with foreach?
Follows code: FindViewById<Button>(Resource.Id.Button_1).Visibility = ViewStates.Gone; The code above is to hide a "button 1" and I have more than 50 buttons. I do not want to copy this whole…
-
0
votes1
answer48
viewsSyntax . cshtml - Devexpress
On the page .aspx, have a Aspxrichedit and at the top of the code I place: <%@ Register Assembly="DevExpress.Web.ASPxRichEdit.v17.2, Version=17.2.5.0, Culture=neutral,…
-
0
votes1
answer563
viewsUnable to read data from the transport Connection: Connection reset by peer
Follows the code: here. Customer code is receiving an exception: Unable to read data from the transport Connection: Connection reset by peer. Why this error? And how can I correct ?…
-
0
votes1
answer234
viewsAuthentication bearer Xamarin
Guys, I’m a beginner in Xamarin and I have a doubt about authentication in an API, when I am consuming via C# or Angularjs for example I can inform in the url the type of authentication (token saved…
-
0
votes3
answers861
viewsString reading Json format for c#
Hello, I’m having several weeks how to do to read the values of string below, I would like to read the value and on the sites is very confused in the search why the type json that I have begins with…
-
0
votes1
answer321
viewsDefault value for property according to type Ef core
I have a code in which I define some properties according to the type of variable in EF6 protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Properties().Where(p…
-
0
votes0
answers48
viewsProblem Related DB
I’m making a system in C#, connected the database (Access) and the program asked to copy the database to the system folder and everything else. The problem is that the application is not saving the…
-
0
votes2
answers108
viewsHandling of Javascript Dates
I need to take a date of an input and add a few years to it and present the result on another label. Ex = 01/01/2017 - User Selected Date 01/01/2020 - Date calculated by js
-
0
votes1
answer84
viewswcf c# error while accessing directory
I’m writing a service WCF using c#. In one of my methods I try to access a directory on the network (any command like directory.Exists() or directory.GetFiles()) and I get the following mistake:…
-
0
votes0
answers67
viewsHow to terminate software after a certain time?
Guys, to be specific I need my system to be inaccessible, after reaching the time determined by me, however this time can not be through the date, I need every time that the software is initialized…
-
0
votes1
answer61
viewsHow to select an Aria-Controls type element
I have been trying in every way to execute the Weddriver Click() method on the button element //*[@id="pedigree-controls"]/div[2]/div/div/button (destacado em azul (dropbtn)) However, for some…
-
0
votes0
answers49
viewsMapping Error and Fluent Api
I’ve just started the study on Asp.Net MVC with Entityframework, I’m having a go at saving the following case: public class Aluno { public int Codigo { get; set; } public string Nome { get; set; }…
-
0
votes1
answer34
viewsCombobox and Sqlreader
I have a ComboBox with a list of items containing names that are generated from my database (I pull up the name of coluna beer that are allocated in the table): private void Form1_Load(object…
-
0
votes1
answer87
viewsenable full transparency of the png background in the form
Well I have a form c# however I use a render png, which contains some shadows and smoke effects, the only way I found to give transparency was the key, but it does not get totally transparent,…
-
0
votes1
answer1049
viewsDatadirectory C#
I need a flexible connection string so that it automatically searches the program folder for file . mdf. My following code is like this: public Form1() { string relative = @"..\..\Database1.mdf";…
-
0
votes1
answer692
viewsUpdate Object List via Entity Framework
Good morning! I wanted to ask for your help just to see if there’s a better way to do it. Today I have a list of objects like Formatacao_RelatorioLinhaDeletada and perform a foreach on this list,…
-
0
votes1
answer669
viewsHow do my ASP.Net MVC project view folders with images?
I have a question, I have a folder with images included in my ASP.NET MVC project, but when my project is running it does not map this folder so it cannot include images to my site. I have the…
-
0
votes1
answer77
viewsCommand similar to sql Convert in c#
I have a return in sql that comes as something like 52,451541554. That return, if I convert it with the command convert(datetime, DtCriacao, 103) of sql it turns into a date format, only that I’m…