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
votes0
answers76
viewsSend a Enter command using Sendmessage Or Postmessage DLL
I am trying to send a enter command using c #, I can write in another process using this dll, but when I am trying to send the enter command is written the following "{ENTER}" ...…
c#asked 7 years, 9 months ago Herbert Junior 410 -
0
votes2
answers100
viewsHow to show the date/time in a modal window?
I have a code below but would like to display the date/time in a modal message box. using System; public class Program { public static void Main() { Console.WriteLine("Hello World");…
-
0
votes0
answers59
viewsWeb Browser does not load link by Navigate win form c#
Good afternoon, I am doing a test to create a Webscraping in c#, but does not load the page in the web form, presenting the javascript error Can anyone help with this mistake?…
-
0
votes1
answer877
viewsShow an image in mvc
Hi, I’d like a hand. I have the following controller to register an image and some fields, and the image property is string: [HttpPost] [ValidateInput(false)] [ValidateAntiForgeryToken] public…
-
0
votes3
answers163
viewsOperator "!=" does not work in my code?
I have a part of my program that I do several checks when the button is clicked and one of these checks is: it picks the value inserted in textboxRankTecnica and has to buy with the array…
-
0
votes1
answer72
viewsHow to create a method that does not wait to finish to return OK
I need to create a method that returns "OK" immediately, without waiting for a method called by it to end. how to do this? [WebMethod] public string ImportaDadosPosLeilaoValores(string fileName) {…
-
0
votes1
answer38
viewsHow do I assign a function to Contextmenustrip in c#?
How do I assign a function to a Contextmenustrip that is on a Notifyicon? I have the following code: private void Thread_Notify_MouseClick(object sender, MouseEventArgs e) {…
-
0
votes0
answers29
viewsSpecify Oracle Entity Framework version
Today we are working with two versions of oracle 12c and 11g. The development is carried out in version 12c. When using the Entity Framework to perform an Count, the same is applying a function that…
-
0
votes0
answers89
viewsHow to start a service?
The function below starts through a file . jar a Webservice. private static void StartService() { try { var FileStart = new…
-
0
votes1
answer54
viewsOpcnetapi performs faster reading while Marikonopc Explorer is open
My application performs reading 24 tags from a Rslinx Classic localhost server. However, I started to notice that the reading of the tags are faster when the Matrikonopc Explorer software is running…
-
0
votes1
answer2633
viewsC# - Get Connectionstring from Appsettings.Json of a dotnet Core MVC application from a Data Access Library
I have an application in . Net Core MVC and I do the data access part using a Dll. How to configure a Connection String according to what was configured in my appSettings.Json of the Netcore MVC…
c# asp.net-core .net-core connectionstring configurationmanagerasked 5 years, 5 months ago Arthur Gresele 1 -
0
votes1
answer24
views -
0
votes0
answers251
viewsPopulate combobox with SQL Server Compact data
I need to fill a combobox with data from a column of SQL Server Compact, the code I have not worked. Class Servidor.cs: public DataTable Load(string sql) { Servidor objSqlCeServerDAL =…
-
0
votes1
answer339
viewsEdit word file using c# and replace
I’m developing an application in c# that needs to handle word files, I can write and read normally but I’m having difficulty formatting the text, I need to insert an array with some information but…
-
0
votes1
answer184
viewsUWP Desktop and database
I’m developing an application for leasing-related business management purposes. The trivial CRUD, reports, controls etc, commonly developed in windows Forms. However, I am making a UWP application.…
-
0
votes1
answer28
viewsVisualstudio Designer does not generate some variables
In the Visualstudio 2010 I am having this problem, where some components have no variables and they are initialized in the method InitializeComponent. But in this way the components are not…
-
0
votes1
answer53
viewsHow to create a list of objects?
Good afternoon, I’m developing a project. NET Core Razor Pages and in it I will need to create and add items in a list... these items are strings and are extracted from an XML. I’ll leave a part of…
-
0
votes1
answer1135
viewsC#, what are methods, classes, and objects?
What are the differences between the three? Do they have any other differences? I’m new to development, and I want to learn more.
-
0
votes1
answer115
viewsProblem in Dialogresult having to press the button 3 times to open
I’m having a serious recurrence problem with Dialogresult. This is the Login screen, thanks to the use of Dialogresult, there is a strange error, you have to press Login twice. The first one picks…
-
0
votes1
answer163
viewsHow to solve errors of these Code?
I’m developing a sales system, using visual Studio 2013 and SQL 2008, for some inconvenience I started using Visual Studio 2012, it turns out I’m having an error. The code is right but when running…
c#asked 7 years, 8 months ago António Mateta 159 -
0
votes2
answers622
viewsConstructor method for calculating age
I am making a very simple client registration application I would like to know how to program a method that calculates and returns the age (in years) from the attribute Anonascimento. I know how to…
-
0
votes2
answers71
viewsjQuery Generic Autocomplete Error 404
I’m making a input with Autocomplete function only that when typing it returns in the console with error 404. Follow the code: $(document).ready(function () { $("#ListaNCM").autocomplete({ source:…
-
0
votes1
answer154
viewsC# take a part of a String
I have a string that in case you have "-" I want to only take what is before the "-" var value = "12345-485" or "7896" I tried using: value. Substring(0,value. Index("-")); If the value has "-"…
c#asked 5 years, 5 months ago Tiago Casanova 778 -
0
votes1
answer451
viewsHow to change a Button’s Text property inside a for
I have a question in ASP.NET, I am creating a loop of repetition inside the HTML so that appear 60 buttons, each with a different number in Text, going from 0 to 59, and then I need to take this…
-
0
votes0
answers77
viewsValidation Validationsummary in a modal receive Json message
My application has a View Create which is opened through a modal and the Controller which was a Actionresult became a Jsonresult then return Json after the request [Httppost]. The [Required] Field…
-
0
votes1
answer281
viewsHow to use parameters in the sql query using Dapper?
How can I make a simple select using Dapper and passing more than one parameter? Method: public IEnumerable<Locais> ConsultarPorTermo(string termo) { const string sql = @"SELECT * FROM Locais…
-
0
votes1
answer38
viewsSwitching between [Page Class] pages in an application
I’m looking up examples of browsing between pages in a desktop application. Let’s assume that the navigation is done from a Listbox always visible in Ui. Most examples do something like this to…
-
0
votes0
answers75
viewsHow to know when the file was loaded 100%
I have a feature that does the following: Load a video from the user’s PC using C# Put the video link in src of an HTML5 using Jquery The problem: It puts the link and shows the player, but as the…
-
0
votes1
answer71
viewsInsert C# data.sqlclient
good afternoon! I’m starting in C# and I have a question ja varios tipo de Insert sql server. Ai I’m having difficulty in this part says: it is not possible to convert from…
-
0
votes0
answers49
viewsMap a Json to a Viewmodel via Automapper
I own the following Json (I’m betting just a piece of it). { "filters": {}, "competition": { "id": 2021, "area": { "id": 2072, "name": "England" }, "name": "Premier League", "code": "PL", "plan":…
-
0
votes3
answers248
viewsUsing Cellclick to load data from a record
I’m doing a C# application in Visual Studio Windows Forms without using a database, I’m controlling everything for a class (Person) and two more classes (Personal and Personal) inherited from the…
-
0
votes1
answer164
viewsProblem disabling Backgroundworker
I am creating in my main form a Backgroundworker object and I have two click events, one to activate and the other to disable the backgroundWorker, but the method to disable is not working.…
-
0
votes1
answer2173
viewsUnity 2d - Enemy follow player
Well, I’m having trouble getting the enemy to follow the player, I did the code below: public class folow : MonoBehaviour { public Transform target;//set target from inspector instead of looking in…
-
0
votes1
answer57
viewsDatatable with class constructor methods for registering
I’m trying to make a DataTable that saves data (I’m not using database) relating to a customer’s name and email and displays in a DataGridView (display on the grid is not the problem, this I know…
-
0
votes1
answer176
viewsHow to get data from Mysql Database?
I have this code snippet where it takes the information from a database field and goes to textBlock, but now I need to fill in some textblock. EX: In the database has name=maria Rg=123 Cpf=456 ai in…
-
0
votes1
answer41
viewsConfigure requestTimeout in code
I got a 502 error, and after much searching I saw that increasing the requestTimeout the problem would work. But I can only increase directly in web.config, thus adding to the line: <aspNetCore…
-
0
votes1
answer101
viewsWhere is the error in this method?
public DateTime HexToDateTime(String hexDate) { long intDate = long.Parse(hexDate, System.Globalization.NumberStyles.HexNumber); DateTime date = new DateTime(1970, 1, 1, 0, 0, 0,…
-
0
votes1
answer61
viewsAn alternative to Strings?
Several things in the project have a table with possible names (strings). But I don’t want to use strings to make comparisons for various reasons (case-sensitive, typo, name table changes, etc). So…
-
0
votes0
answers49
viewsUpdate BD Website
I need help because I’m making a website where : I show the values of the BD lines and have the option to update the data via Web. When I try to update it gives me the following error: Description:…
-
0
votes2
answers504
viewsEditing Row by a textbox and receiving in the datatable
I have a class that has two methods that receive what is typed in textBox, all this stored in one dataTable (without database). When I click on a line (Row) of dataGridView I show the values saved…
-
0
votes2
answers207
viewsUse different screen resolution according to the monitor
I am developing an application in 1920x1080, but the Pcs that will run are 1280x720 and 1366 x 768. When I run in mine it looks exactly as I want, but when I run in these resolutions, a lot is…
-
0
votes1
answer427
viewsSearch CLASS element with value in space
I am doing an automation with Selenium C# and the only standard reference of the tag is a class referenced by other classes: <div class="slds-form-element slds-form-element_readonly"> I’ve…
-
0
votes1
answer787
viewsHow to extract the information from the Itau return file in C#?
I’m developing an application in which the Boletonet library is being used to generate billets. In this case the library itself when generating the boletos also generates the remittance file that…
-
0
votes0
answers35
viewsSelect2 selector implementation with Selenium Webdriver
I am new with automated testing and Selenium Webdriver (c#), currently I am doing a test where there is a Select2 field, need to know how to implement for my test look at this field and select a…
-
0
votes2
answers55
viewsUse Relative Form in Usercontrol
I’m trying to create a Usercontrol so you can call different Forms, however changing only the controls he make the call. Shows the error that the "Form" is non-existent. public partial class…
-
0
votes1
answer162
viewsHow to pass properties of another model?
Problem: I have an index that uses a model of the type: @model IEnumerable<projeto.Models.classe1> I need to access some properties of classe 2, my classe1 being Ienumerable, how can I access…
-
0
votes2
answers256
viewsHow do I make the program display a message once on the last day of the month?
I am working on the development of a financial program in Windows Forms and a requirement appeared that I am not yet knowing how to do. The requirement is as follows:: On the last day of the month…
-
0
votes1
answer65
viewshow to take value from an autocomplete and send to the controller (AJAX)
You can receive the chosen value from a field and use this value in a variable in the controller? This is my field: <div class="form-group hidden" id="idnome" > <label>NOME…
-
0
votes1
answer344
viewsHow to convert SQL command to LINQ?
I have two classes: Produção { int id, procedimento int, quant int string competencia } bpi { int id, ini idProducao } How to convert the code below to LINQ? select ((sum(procedimento) + sum(quant))…
-
0
votes2
answers32
viewsTimeout Connectiostring
I have a question about the Timeout value that can be passed in Connectionstring, this value is related to seconds or milestones? <connectionStrings> <add name="MyConnection"…