Click here to Skip to main content
15,936,850 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can i focus cursor on sepecific textbox.

I tried using

This is working when on form load. But when i load
item in the listbox does not select the textbox.

Also i tried using

Its the same.

What i want is when i click a button or lets say when i press
Save button and show dialogbox of Yes or No ,
When i press Yes and save the file ,cursor will
Go to the specific textbox. textBox1.

What I have tried:

Tried using this:

Updated 4-May-22 20:41pm

1 solution

Looking at your code sample, I am assuming that you are talking about a WinForm app.

Here is the documention on how to set the selected item in a listbox: ListBox.SetSelected(Int32, Boolean) Method (System.Windows.Forms) | Microsoft Docs[^]

Here is the Google Search used to find the information: winform listbox set selected item[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900