|
-
Oct 30th, 2002, 03:56 PM
#1
Thread Starter
Junior Member
Visual Basic 6 Buttons
Well I have a question, I have two buttons in the Form; Command1 and Command2. Currently when the appliation starts the user can press both of them as they please.
Well I dont want that. the thing that I want to do; When the app start the user can ONLY Click on the Command1 button and after the user clicks on Command1 button they shouldn't be able to click on Comman1 again but can click on Command2 this time.
Any help will be appreciated.
-
Oct 30th, 2002, 04:00 PM
#2
control it using
buttonname.Enabled = True/False
-
Oct 30th, 2002, 04:01 PM
#3
Lively Member
How about this, I'm a newb but I'll try my best 
VB Code:
' Code behind Command1 button
Private Sub Command1_Click()
Command1.Enabled = False
Command2.Enabled = True
End Sub
' Code behind Command2 button
Private Sub Command2_Click()
Command1.Enabled = True
Command2.Enabled = False
End Sub
And when your making the layout put the Command2 button enabled property to false. That should do it
-
Oct 30th, 2002, 04:01 PM
#4
Banned
First, set the .Enabled property of command2 to False.
Then use this code in the click event of Command1
VB Code:
Command1.Enabled = False
Command2.Enabled = True
-
Oct 30th, 2002, 04:02 PM
#5
Hyperactive Member
By the time I reply this your question would probly be answered.
VB Code:
Private Sub Command1_Click()
If not Command1.enabled=False Then
Command1.enabled=False
Command2.enabled=True
End If
End Sub
Private Sub Command2_Click()
If not Command2.enabled=False Then
Command2.enabled=False
Command1.enabled=True
End if
End Sub
53323737 15 743 313402 05 740313063. 17 15 4150 743 313402 05 140393403437 5203 743 30210.

-
Oct 30th, 2002, 04:17 PM
#6
Thread Starter
Junior Member
thanks a lot.. you guys are really fast I am happy that I found this board
Last edited by iimrii; Oct 30th, 2002 at 04:28 PM.
-
Oct 30th, 2002, 04:26 PM
#7
PowerPoster
Disable command1 in the properties window on the right. Set enabled to false over there.
-
Oct 30th, 2002, 04:27 PM
#8
Banned
Then you should set Command1.Enabled = False at design time:
Click on command1 and select the enabled property in the property bar. Then set it to false.
-
Oct 30th, 2002, 04:30 PM
#9
Thread Starter
Junior Member
holly I figured that out by myself I was just gonna edit the post but you guys already posted you guys are realllllyyy fast 
These might be really easy questions for you but I am really new to VB
-
Oct 30th, 2002, 04:46 PM
#10
Fanatic Member
You can also do it like this:
VB Code:
Option Explicit
Private Sub Command1_Click()
Command1.Enabled = Not (Command1.Enabled)
Command2.Enabled = Not (Command1.Enabled)
End Sub
Private Sub Command2_Click()
Command1.Enabled = Not (Command1.Enabled)
Command2.Enabled = Not (Command1.Enabled)
End Sub
Private Sub Form_Load()
Command2.Enabled = False
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|