お世話になります。
VS2010,C#,.Netframework4.0でフォーム内にテキストボックスとボタンを配置して、
ボタンクリック時にボタンEnabledプロパティ操作とテキストボックスのテキストを設定すると
2回目以降のボタンクリックでテキストボックスのテキストが全選択状態となります。
ボタンプのロパティ操作を行わない場合やテキストボックスのSelectionStartプロパティを設定すると
全選択状態は回避できるのですが、なぜ全選択になるのか理由が分かりません。
どなたか、ご説明頂けないでしょうか?
namespace FormTextbox
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
textBox1.Text = "123";
textBox1.SelectionStart = textBox1.SelectionStart;
}
private void button1_Click(object sender, EventArgs e)
{
button1.Enabled = false;
textBox1.Text = "123";
//textBox1.SelectionStart = textBox1.SelectionStart;
button1.Enabled = true;
}
}
}