private void button1_Click(object sender, EventArgs e)
{
int a;
double b,c;
if (textBox1.Text== "")
{
MessageBox.Show("Unesite vrednos a");
textBox1.Focus();
}
if (textBox2.Text== "")
{
MessageBox.Show("Unesite vrednos b");
//textBox1.Select();
textBox2.Focus();
}
//itd.
a = Convert.ToInt32(textBox1.Text);
b = Convert.ToDouble(textBox2.Text);
c = a * b;
textBox3.Text = c.ToString();
}
program odradi MessageBox,ali textBox ostane bez fokusa i dolazi do pucanja programa.Koristim MV C# 2008 Express Edition i totalni sam pocetnik u pomenutom programskom okruzenju.Ranije sam koristio Turbo Delphi 2006.i u njemu se ovaj problem resava ovako:
if Edit1.Text=' ' then begin
ShowMessage('Unesite vrednost a.');
Edit1.SetFocus;
Exit;
end;
Kako resiti ovaj,za mene,veliki problem.