How to write and block the textbox by clicking the button

0

I would like to know how to type a number in the textbox and block when the button is clicked

 private void button6_Click(object sender, EventArgs e)
 {
        textBox4.Enabled = false;
 }

I was able to block it, but writing inside it could not, does anyone explain how to do this?

    
asked by anonymous 16.11.2016 / 00:00

1 answer

0

For code and comments you only need typing blocking, instead of using Enabled " which is very restrictive and disables including events use ReadOnly :

private void button6_Click(object sender, EventArgs e)
{
    textBox4.Text = "Texto Padrão";
    textBox4.ReadOnly = true;
}

To appear when you double click it is locked for typing, it goes into the event box and uses DoubleClick :

  

privatevoidtextBox4_DoubleClick(objectsender,EventArgse){MessageBox.Show("Bloqueado !!!");
}

To start the TextBox without visibility:

Form_Load

private void Form1_Load(object sender, EventArgs e)
{
     textBox4.Visible = false;
}

or properties box :

  

    
16.11.2016 / 00:24