InvisibleBtnForm.vb
1: ' Invisible Button Technique Demo
2: ' this project shows how to put the initial focus on an "invisible"
3: ' button (one with a width of zero). It will appear that no control
4: ' has the focus initially. this is especially useful when the control
5: ' that logically should have the lowest TabIndex is a RadioButton.
6: '
7: ' Once the invisible button loses the focus, we want to remove it from
8: ' the tab cycle (otherwise a user might get confused).
9: '
10: ' Written 2/2010 by Wayne Pollock, Tampa Florida USA
11:
12: Public Class InvisibleBtnForm
13: Private Sub InvisibleBtn_LostFocus(ByVal sender As Object, _
14: ByVal e As System.EventArgs) Handles InvisibleBtn.LostFocus
15: ' Make sure this button never gets the focus again:
16: InvisibleBtn.TabStop = False
17: End Sub
18:
19: Private Sub ExitBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitBtn.Click
20: Me.Close()
21: End Sub
22:
23: Private Sub InvisibleBtnForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
24: ' When the form is loaded (made visible) the RTF styled text is
25: ' loaded from the named Resource, which was created using WordPad
26: ' and added to the project's resources vial the Project's Properties page
27: ' (added an existing file "InvisBtnText.rtf"):
28: RichTextBox1.Rtf = My.Resources.InvisBtnText
29: End Sub
30: End Class