Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
リストボックスでアイテムを選択すると、選択したテキストがテキストボックスに入力されて編集されます。編集する前にマウスでクリックする必要がないように、テキストボックスのテキストにカーソルを合わせるにはどうすればよいですか?
コントロールのFocusメソッドを使用するだけです:
Focus
TextBox1.Text = selectedItemText; TextBox1.Focus();
または
TextBox1.Select();
または、TextBox の最後の文字の後にカーソルを置きたいだけの場合:
TextBox1.Select(TextBox1.Text.Length, 0); TextBox1.Focus();