Questions tagged as 'c#'

1
answer

How to resize an image in C #?

I'm working on an application that receives images. It turns out that the client sometimes sends these images with a very large resolution, which is not necessary in our case (reaching 7MB). I need the image to be at most 1200 wide (the resol...
asked by 08.03.2018 / 13:08
1
answer

How to apply 2 mascara in the same textbox windows form c #

I have 2 checkbox of person and company, and only a textbox . I want to select in% with% of individual, I want to apply the mask to CPF, or when selecting the legal entity, it applies the mask to CNPJ in checkbox . I do...
asked by 15.03.2018 / 18:29
2
answers

Inherit comments from a virtual object

How can I inherit comments within the tag <summary> of an object? I have the following class: class BASE { /// <summary> /// String de Conexão a base de dados. /// </summary> public virtual string...
asked by 16.03.2018 / 13:17
2
answers

Better performance compared to strings

What is the best performance option? And memory allocation? Use option 1 or 2? String text = "ola mundo"; Option 1: If ( Strings.len(text) > 0 ) {} Option 2: If ( text != "") {}     
asked by 10.03.2018 / 11:54
2
answers

Is this a property, class attribute or what?

I have this in my code: public ICommand ChangePositionCommand => new Command((obj) => { _positionIndex++; if (_positionIndex >= Positions.Count) _positionIndex = 0; Position...
asked by 28.12.2017 / 15:49
2
answers

The property or indexer "Color.Name" can not be assigned because it is read-only

Here is the code where I define SegundaTela : public partial class Form1 : Form { SegundaTela telaSecundaria; } Code: telaSecundaria = new SegundaTela(); telaSecundaria.label_segunda_tela.BackColor.Name = cor_fundo; I get err...
asked by 05.12.2017 / 03:54
3
answers

Pass Controls to a Function

I have an interface in Visual C #. In this interface I have a class named T50 that contains all the variables I need. I've already implemented a button where the object created by the T50 class was saved. I can save and read this object (Usin...
asked by 01.08.2015 / 21:48
2
answers

CPF mask in the textBox?

I'm using the following code: string numero = ""; private void MaskeditCPF(TextBox txt, KeyEventArgs e) { //Verifica de a tecla digitada foi algo diferente de números ou BackSpace if (e.Key != Key.Back && (e.Key < Key.D0 ||...
asked by 12.07.2015 / 17:22
3
answers

Add column of DataGrid only with valid values

I'm using this function to add a column from my datagrid public void Somatorio() { decimal total = 0; foreach (DataGridViewRow row in dgv_inico.Rows) { total += Convert.ToDecimal(row.Cells["valor"].Value); } lbl_so...
asked by 09.10.2017 / 16:03
1
answer

Variables in C #

Is it possible to use variable variables or something similar in C # as in PHP for example? $example = "etc.."; $var = "example"; // variáveis variáveis echo $$var; // etc... echo ${$var}; // etc... If it is not possible, why? The typing,...
asked by 03.12.2017 / 10:15