Hi
I have a project with two tab pages.
The first tab I use to query PCs. There is a textbox where the PC name is entered and a button my users click and PC info is returned.
The second tab I use to query user details.
On the User tab page, the user naturally has PCs that are assigned to them.
These are returned to a Datagridview when I query against the user.
I would like to be able to double click on one of the PC names in the datagridview on the User tab page, and with the mouse double click event, switch focus to the PC tabpage and populate the PC name textbox. I know how to populate the textbox with the line from the datagridview but is it possible to change focus as part of the mouse double click event?
thanks in advance
Change Tab Focus by Mouse Double Click Event
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
-
- Posts: 55
- Last visit: Thu Jun 24, 2021 3:05 am
Re: Change Tab Focus by Mouse Double Click Event
Use the "Focus()" method of the control.
$textbox.Focus()
https://docs.microsoft.com/en-us/dotnet ... trol_Focus
$textbox.Focus()
https://docs.microsoft.com/en-us/dotnet ... trol_Focus
-
- Posts: 55
- Last visit: Thu Jun 24, 2021 3:05 am
Re: Change Tab Focus by Mouse Double Click Event
Hi - I have tried the following - I put a button on a different tab page as a test, clicking the button doesn't change the focus to the tab page where the text box is? What am I missing? Thanks
$button1_Click={
#TODO: Place custom script here
$textbox_computername.Focus()
}
$button1_Click={
#TODO: Place custom script here
$textbox_computername.Focus()
}
-
- Posts: 55
- Last visit: Thu Jun 24, 2021 3:05 am
Re: Change Tab Focus by Mouse Double Click Event
No in this instance I am just trying to test the focus method. Should I expect my example above to work? Thanks
-
- Posts: 55
- Last visit: Thu Jun 24, 2021 3:05 am
Re: Change Tab Focus by Mouse Double Click Event
Sorry, in this instance I want to test performing an action with a control in one page tab to see if it will change the focus to another page tab.
As a test I set the button1 click event on one tab page to change the focus to my text input box on the other tab page. Running the project and clicking the button had no effect. Would you expect the behavior I described?
$button1_Click={
#TODO: Place custom script here
$textbox_computername.Focus()
}
As a test I set the button1 click event on one tab page to change the focus to my text input box on the other tab page. Running the project and clicking the button had no effect. Would you expect the behavior I described?
$button1_Click={
#TODO: Place custom script here
$textbox_computername.Focus()
}
-
- Posts: 55
- Last visit: Thu Jun 24, 2021 3:05 am
Re: Change Tab Focus by Mouse Double Click Event
Hi - I have changed to select - it still does not take me to the other tab?..
$button1_Click={
#TODO: Place custom script here
$textbox_computername.Select()
}
$button1_Click={
#TODO: Place custom script here
$textbox_computername.Select()
}