To focus or not to focus
-
Hi, I have write a simple application only to understand the Select command, but it doesn't work well. In my application i have 3 button. When I click button 1 i disable button 1 and 2. When I click on button3 i reanable button 1 and 2 and want to select button 1 again. The code (without the designer part) i wrote is the following:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { button1.Enabled = false; button2.Enabled = false; } private void button3_Click(object sender, EventArgs e) { button1.Enabled = true; button2.Enabled = true; button1.Select(); } } }
What should i do to solve this problem? Best Regards Ciao Rudy Barbieri -
Hi, I have write a simple application only to understand the Select command, but it doesn't work well. In my application i have 3 button. When I click button 1 i disable button 1 and 2. When I click on button3 i reanable button 1 and 2 and want to select button 1 again. The code (without the designer part) i wrote is the following:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { button1.Enabled = false; button2.Enabled = false; } private void button3_Click(object sender, EventArgs e) { button1.Enabled = true; button2.Enabled = true; button1.Select(); } } }
What should i do to solve this problem? Best Regards Ciao Rudy Barbieri -
Hi, I have write a simple application only to understand the Select command, but it doesn't work well. In my application i have 3 button. When I click button 1 i disable button 1 and 2. When I click on button3 i reanable button 1 and 2 and want to select button 1 again. The code (without the designer part) i wrote is the following:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { button1.Enabled = false; button2.Enabled = false; } private void button3_Click(object sender, EventArgs e) { button1.Enabled = true; button2.Enabled = true; button1.Select(); } } }
What should i do to solve this problem? Best Regards Ciao Rudy BarbieriUse Focus instead of select
button1.Focus()
Saqib
-
It works. I didn't see any problem. After clicking button3, the selection is back to button1.
try to put other buttons on the from, put you code not in the first buttons ...., it will not work
When you get mad...THINK twice that the only advice Tamimi - Code