Unable to set focus on ToolStrip button - vb.net

I have tried to research this all morning and found no solution that worked for me.
I have a ToolStrip, with several buttons on it. I am unable to get figure out how to select any of the buttons when using tab. I did find that it would systematically select the toolstrip but showed no visual indication of that. I only found this out by hitting the left arrow key each time I hit tab.
So my question is, how can I get one button on the toolstrip(Button1) to be selected (so that when I would hit enter, it would automatically use the button) by hitting the tab button.
I have turned the TabStop = True and the TabStop on the main UC is also set to True. I have assigned the ToolStrip a final Index number also. But still nothing gets highlight, but it's focused. I want the Button1 to be focused when I focus the ToolStrip.
Thanks for your help in advance!

ToolStrip.Focus()
Button.Select()

You cant set focus to any button in toolStrip except first Button or any element.
So dont try it.
Its Waste of time...I already tried..that.

Related

tabindex not being set when textbox has focus

I have a textbox that when focused it calls an ajax request and populates a list for the user to choose from. Basically just recreated the dropdown using a textbox instead of a select.
The problem is that if I click on the textbox the browser does not recognize the tabindex of the input. Instead it resets its self and starts back at 0. If I tab to the next element tabs work fine, only when I click in the input field to give it focus does it start acting up.
I did notice last night if I put an alert in the page on the focus event that it seems to work. Guessing because the browser focuses on the elememt after I click the ok button.
has anyone heard of this before?
found what was causing the problem. I was calling .blur() on keydown and code was 9 or 13 (Tab/Enter). Not sure why this would give me the problem I was having. I would have just thought the blur event would have executed twice. However I suppose that I was forcing blur on keydown and the current tabindex was not being set. If this is the case then If I needed to I should beable to call blur() onkeyup event.

How can I remove windows right click menu?

I have a group of text boxes within my form. Whenever I right click on them or the panel they are in, I get this menu:
I want to remove this menu from showing, and leave the right click to be nothing. However, the mouseclick event never fires for any of these. Therefore, I am having trouble getting rid of it. It usually shows up when my text is highlighted.
Is there a way to remove it? Or am I looking in the wrong event?
Another option is to set the ShortcutsEnabled Property of the TextBoxes to False:
Use the ShortcutsEnabled property to enable or disable the
following shortcut key combinations and the control’s shortcut
menu
This disables the keyboard shortcuts as well; not sure if that is applicable to your scenario.

Triggering Visual Basic Keydown events without a specific function

I'm building on top of code that a previous developer has left me, and he left something that intrigued me quite a bit.
Basically on his menus, he has a TextBox to take in user input and a button next to it to submit the value of the TextBox (for example if the user wanted to select option 1, he would input 1 into the TextBox and click the button). However, the user could also press the Enter key while focusing the TextBox, and it would be treated as the submit button was clicked.
Now this is simple enough to do, but when I check the VB code behind the menu, there's no TextBox_Keydown(...) Handles TextBox.Keydown function anywhere, only the button click event. How is he doing this? He has several menus that are similar and I can't figure out how.
A standard dialog box, if not told to act otherwise, enter does default command button and escape does cancel. In VB look at the properties Default for the command button.
I discovered how he was doing it. He basically mapped the AcceptButton and CancelButton properties of the entire Windows Form to various button functions.

Program does not tab through controls in the correct order

I have a form with a button which adds text boxes in addition to the 8 text boxes already on the form which are named Textbox1 through 8. When I launch the application and enter the first textbox, I can tab through all the way from 1 - 8.
When I click my button it programmatically creates a textbox below the last textbox with appropriate name such as Textbox9 for the ninth, Textbox10 for the tenth etc.
However when a textbox is added via the button, tabbing through the controls skips from the eighth, to any buttons on the form, and then to the created textbox. Any idea why this happens and how I can resolve it? I've tried google to no avail. Please let me know if you need any code, thank you.
Thanks to Daniel Cook and Grim, I solved my issue by setting the tabindex to match the textbox number, however I also found that setting TabStop to false on the buttons and controls helped me to keep the tab focus within the text boxes.

Need to change focus to another text box before buttons are activated

I am entering data into text fields in a browser via "type" command. In order for the Save and Cancel buttons to be activated (not grayed out), I need to click in another text field to change focus. This works manually, but I can't seem to figure out how to do it programmatically. I have tried click, clickAt, doubleClick, mouseOver/click/mouseOUt, mouseDown/mouseUp, focus, fireEvent ... all without luck. Thanks for any suggestions!
Does tabbing out of the input field enable the buttons? If so, maybe you can just do:
WebElement element = driver.findElement(By.id("your_input_field"));
element.sendKeys(Keys.TAB);