Help With Button Click

RPBLEA

Active member
Joined
Apr 26, 2005
Messages
36
Programming Experience
1-3
Okay I got it set to when a button is Link button is clicked, A Datagrid Visibility is set to True, Then I have the Text on the button change to Hide Datagrid

How do I set an if statement up or somehow set it up so that when it's clicked the first time, the datagrid is set to true, and the second click on the same button is set to not show the datagrid?
 

DavidT_macktool

Well-known member
Joined
Oct 21, 2004
Messages
502
Location
Indiana
Programming Experience
3-5
At top of form:
Public showGrid As Boolean = True
on form load
Grid1.visible = True

on the button click event:

If showGrid = True Then
Grid1.visible = False
'update text here
showGrid = False
Else
Grid1.visible = True
'update text here
showGrid = True
End If
 
Last edited:

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,345
Location
Sydney, Australia
Programming Experience
10+
How about in the buttons Click event handler:
VB.NET:
Grid1.Visible = Not Grid1.Visible

If Grid1.Visible Then
	Button1.Text = "Hide Grid"
Else
	Button1.Text = "Show Grid"
End If
 
Top Bottom