J
John
I found out this by accident when I tried to walk through my code in debug mode:
Here is the step to reproduce:
1. create a project
2. add a form into project
3. add a tab control in project (2 tab pages)
4. put one label (label1) control on tab page 2, set it visible = false
5. put one label (label2) control on form, set it visible = false
6. put one label (label3) control on tab page 1, set it visible = false
7. add a button on form (not inside tab page), set the visible = false
inside the form load code, have the following code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Button1.Visible = True
If Me.Button1.Visible Then
Button1.Text = "Visible"
Else
Button1.Text = "Invisible"
End If
Me.Label1.Visible = True
If Me.Label1.Visible Then
Me.Label1.Text = "visible"
End If
Me.Label2.Visible = True
If Me.Label2.Visible Then
Me.Label2.Text = "visible"
End If
Me.Label3.Visible = True
If Me.Label3.Visible Then
Me.Label3.Text = "visible"
End If
End Sub
Set break point at first line of code, step line by line,
We have code to set Me.Label1.Visible = True
BUT the next statement will evaluate the the Me.Label1.Visible = False so the Label1.Text will not be set.
Any idea?
This bug/behavior really make code very hard, is there any hotfix for this?
Thanks!
Here is the step to reproduce:
1. create a project
2. add a form into project
3. add a tab control in project (2 tab pages)
4. put one label (label1) control on tab page 2, set it visible = false
5. put one label (label2) control on form, set it visible = false
6. put one label (label3) control on tab page 1, set it visible = false
7. add a button on form (not inside tab page), set the visible = false
inside the form load code, have the following code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Button1.Visible = True
If Me.Button1.Visible Then
Button1.Text = "Visible"
Else
Button1.Text = "Invisible"
End If
Me.Label1.Visible = True
If Me.Label1.Visible Then
Me.Label1.Text = "visible"
End If
Me.Label2.Visible = True
If Me.Label2.Visible Then
Me.Label2.Text = "visible"
End If
Me.Label3.Visible = True
If Me.Label3.Visible Then
Me.Label3.Text = "visible"
End If
End Sub
Set break point at first line of code, step line by line,
We have code to set Me.Label1.Visible = True
BUT the next statement will evaluate the the Me.Label1.Visible = False so the Label1.Text will not be set.
Any idea?
This bug/behavior really make code very hard, is there any hotfix for this?
Thanks!