Questions tagged as 'c#'

1
answer

How to stop printing positions = 0 of a vector?

In the example below, how would I stop printing the positions of this vector that are equal to 0 int[] caluculo = {50,6,0,59,6,7,0,6,8}; for(int i = 0 ; i < 9 ; i++) { Console.WriteLine("{0}",calculo[i]); }     
asked by 24.02.2018 / 15:16
1
answer

How to pick up the current day

How do I display the current day in a program? But I did not want to take the zero to the left. For example: on 01 I want it to be 1, on 02 I want it to be 2.     
asked by 03.10.2018 / 18:58
2
answers

How to create events in C #?

I have two classes one that has a list and I would like to have an event that every time this list was changed this event was called. public class Exemplo { List<string> lista = new List<string>(); //Quando esta lista foi a...
asked by 09.07.2018 / 19:28
2
answers

Why does .all in an empty list return true?

I was having an error in a business rule, and by investigating, I came up with the following code snippet, which is intended to check if all processes in a list are active: return processos.All(proc => proc.Ativo) When debugging,...
asked by 12.07.2018 / 20:26
2
answers

Changing Images from a PictureBox C # - Windows Form Application

Good Afternoon Personal,
asked by 31.07.2018 / 20:32
3
answers

Error traversing vector

The user pastes the values that will be saved into the vector and then displays those values. However the following error is occurring:   An unhandled exception of type 'System.IndexOutOfRangeException' occurred in vetoor.exe ". My code l...
asked by 04.01.2017 / 22:01
3
answers

sending email by smtp

I made a class that has the following code to send an email: try { WebMail.SmtpServer = "smtp-mail.outlook.com"; WebMail.SmtpPort = 25; WebMail.EnableSsl = true; WebMail.UserName = "meuem...
asked by 30.06.2016 / 06:40
3
answers

Is it possible to add connection string within a class?

I have a project of type class library where I have my Context, in it I get the SQL connection that is in my web.config . How can I add the SQL connection so that it stays inside the DLL? I want to pass the direct connection here, w...
asked by 05.07.2016 / 21:19
2
answers

C # - I / O on the network [closed]

I have a program that does I / O of files (create, edit, save), but I need to put it to do this I / O with files that are in the company network, both reading and writing. My question is: Does my program need file read and write permission, or...
asked by 02.05.2016 / 21:13
2
answers

Voice recognition does not work

Recently I formatted my notebook and had to reinstall everything, but now my TCC project is in error, which I did not have before. In this code snippet: SpeechRecognitionEngine sre = new SpeechRecognitionEngine(new CultureInfo("pt-BR"));...
asked by 22.05.2016 / 18:07