Question TextAlign In Even Enter and LostFocus ????

ionedey

New member
Joined
Feb 19, 2009
Messages
1
Programming Experience
Beginner
Question 1:
in VB.net windows From with 2 TextBox Control (in Visual Studio 2008)
property:
name: TextBox1
text: test1

name: TextBox2
text: test2


with source code:
VB.NET:
Private Sub TextBox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Enter
  TextBox1.TextAlign = HorizontalAlignment.Left
  TextBox1.SelectAll()
End Sub

Private Sub TextBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.LostFocus
  TextBox1.TextAlign = HorizontalAlignment.Right
End Sub

if i use press tab this app working normaly
but if i use mouse click to focus, text value has empty.
Why?
Please Help Me, whats wrong in my source code?

Question 2:
How To Understand:
When you change the focus by using the keyboard
(TAB, SHIFT+TAB, and so on),
by calling the Select or SelectNextControl methods,
or by setting the ContainerControl..::.ActiveControl
property to the current form, focus events occur in
the following order:
1.Enter
2.GotFocus
3.Leave
4.Validating
5.Validated
6.LostFocus

When you change the focus by using the mouse or by calling the Focus
method,
focus events occur in the following order:
1.Enter
2.GotFocus
3.LostFocus
4.Leave
5.Validating
6.Validated

Thanks... 1000x
 
Back
Top