Questions tagged as 'c#'

3
answers

How is the usign (MySqlConnection) C # used?

Hi, I want to know the correct way to implement the using (MySqlConnection cn = new MySqlConnection() It is assumed that when creating a connection within this using when I finish executing what is inside the block I will release...
asked by 28.11.2016 / 21:06
3
answers

Detect status of Caps Lock in c #

I have a password field in a Windows Form of C# and I need to show the user an alert if the CapsLock function is enabled. How can I detect if the CapsLock function is activated?     
asked by 27.07.2017 / 13:36
2
answers

What is the operator for? : (conditional operator) in C #

I have a little doubt with the following code: int n1 = 20; int n2 = 10; int n3 = (n1 > n2) ? n1:0; Console.WriteLine(n3); Console.ReadKey(); I do not understand why n3 ends up being 20 What roles fulfill the ? and the...
asked by 18.05.2017 / 02:03
2
answers

I get an error when accumulating the sum, I get "Local variable not assigned"

public static void BucleFor() { int i,numero, dato, repuesta; Console.WriteLine("Cantidad de numeros a sumar"); dato = Convert.ToInt32(Console.ReadLine()); for (i=1; i<=dato; i++) { Console.WriteLine("introdusca...
asked by 26.03.2018 / 05:30
3
answers

Insert records in the form of a table

Good afternoon, I am working on a restaurant system in C # using Windows Forms, which is the part of taking the order: What I want to achieve in inserting this order in table form in SQL SERVER In the following table: and how I...
asked by 28.09.2018 / 00:46
1
answer

How to convert the delimiter of a csv file

I have a .csv file which each column and its contents is separated by commas. What I'm looking for is to be able to change each comma separator with a Pipping (|) and do this in C #. I've searched on Google but I can not find anything conc...
asked by 23.01.2018 / 19:59
1
answer

Is it possible to do several toString () of the same class in c #?

I have a defined class which I want to take two methods toString (), especially for the aesthetics of the program, I want in one case to display several variables (for a listbox) and for another only one variable (for a combobox) , in the follow...
asked by 03.10.2018 / 06:57
1
answer

Number saved as text in excel

I have an automatism that takes data from different data sources, the problem is that there are some decimal data that I save as text. How can I do so that I do not save these numbers as text? This is what I have now //Variables interop...
asked by 12.04.2018 / 10:09
1
answer

order by len () in linq

This is my query on the sql server and everything works fine select * from DetalleNotas order by len(ColProduct), ColProduct PROCT1 PROCT2 PROCT3 PROCT4 PROCT5 PROCT6 PROCT7 PROCT8 PROCT9 PROCT10 but I want my query in linq I trie...
asked by 04.05.2018 / 17:46
3
answers

Format percentage in C #

I'm having a little problem with formatting numbers by percentage, I have a List<decimal> that has these elements 0.006250 0.010000 0.012500 0.016600 0.025000 0.050000 I intend to get back: 0,0625% 1% 1,25% 1,66% 2,5% 5% I...
asked by 03.09.2018 / 20:19