Questions tagged as 'c#'

3
answers

Problem with PadLeft [duplicate]

I have a problem using the PadLeft method. I need to put some zeros in front of a string, but I can not. For example: string value = "2001795"; string newValue = value.PadLeft(5, '0'); Theoretically, the string "newValue" should be set to...
asked by 24.02.2017 / 13:40
3
answers

Show property value instead of class name in DataGridView [closed]

I have a DataGridView that should show data between related tables and I can not show the data correctly, it shows the name of the nameSpace followed by the name of the class. I saw some things and they showed an override, but I also read that i...
asked by 07.10.2016 / 14:51
2
answers

Using IEnumerable

I saw an example in another post about using IEnumerable var ent = new EntFuncionarios(); IEnumerable<Funcionario> funcionario = ent.Funcionarios; IEnumerable<Funcionario> temp = funcionario.Where(x => x.FuncID == 2).ToL...
asked by 20.11.2014 / 19:45
2
answers

Treat return in class in C #

I have a Mesa class: public class Mesa { public int Cdmesa { get; set; } public int Flsituacao { get; set; } public string Status { get; set; } } I would like to return the Status with the following conditions:    If S...
asked by 28.10.2016 / 17:39
3
answers

Retrieve MAX value from an SQL column

string var = ""; SqlConnection con = new SqlConnection(Banco._strCon); string sql = "select max(end_id) from endereco"; SqlCommand cmd = new SqlCommand(sql, con); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); if...
asked by 27.10.2015 / 16:26
2
answers

Fill in several combobox

I can fill a combobox with DataTable, but in my case I need to fill 2 combobox and 1 checkedboxlist with data from a MySQL bd //formulário cadastro private void frmCadastroRecibo_Load(object sender, EventArgs e) { Classes.DBconect con = ne...
asked by 11.12.2014 / 05:53
2
answers

Encrypt ini files

I need a script that compiles a .ini to avoid an easy reading. The file should be read with PHP. It seems that C # has a similar feature. The question is how do I do this and then I read .ini with PHP. Example of file .ini...
asked by 10.12.2014 / 22:01
2
answers

Start Windows Forms program in the background

I developed a monitoring application using Windows Forms, but it does not need to have anything visual at the moment, so I'd like it to run when it runs in the background (I'd like the icon to stay where the icons are viruses, etc.). I do not...
asked by 01.08.2017 / 16:17
2
answers

Remove a quantity N of days on a date

How can I remove a quantity of N days on a date? Example: namespace TesteData { class Program { static void Main(string[] args) { var dataAtual = DateTime.Now.Date; // dataAtual 13/09/17 var qtdDias = 5;...
asked by 13.09.2017 / 22:25
3
answers

How can I manipulate a PSD file to get the position of the layers?

I'm working on a project where we have a .psd (Photoshop) file called "sprites" that contains all the site's icons. I'd like to be able to get the positions of each layer to be able to automatically generate a css file by positioning each i...
asked by 24.12.2013 / 19:06