Question Help with buttons

WiiFan2012

Member
Joined
Jan 15, 2010
Messages
17
Programming Experience
Beginner
This is the new question:

I would like to know how to make a button click only so many times until it becomes disabled.

I would also like to know how to keep what is put in a RichTextBox there, without erasing the other text;

Example:
Two buttons, the first puts "1" into the RTB, and the second puts "2" into the RTB. However when I press the second button, it over writes the first value.

How can I prevent this????







You Can Ignore this question below;
Old Question: I am working on a counter, and want to know how to make a button show itself if I hid it.

I have:

VB.NET:
Button1.Hide()
Button2.Hide()
Button3.Hide()

And would like to know how to make one of the buttons visible again, with one big button.

I know it has something to do with an "If" statement.

Answer: Button#.Show()
 
Last edited:
To disable a button after a certain number of clicks:

Use a Static counter variable. Example:

Static count As Integer
count += 1
If count = 5 Then Button1.Enabled = False


To add text to a textbox without overwriting it:

Concatenate the text to what is already there. Example:

Textbox1.Text &= newstring
 
or you may try

rtb.appendtext((Chr(13) & Chr(10)) & "Second Line Value")
 
The Button code works great, but how may I run it throughout the application's life time?
It works once then stops working.

I tried both the textbox codes, and both came up with an error.....

Thanks for the help:)
 
You need to be more explicit when you explain what you want.

Your post indicated that you wanted the button disabled after a certain number of clicks. You didn't say that you wanted it to be reenabled later.

If that's the case, then you need another button to reenable the first button. You also need to reset the count variable back to 0.

Static count As Integer
count += 1
If count = 5 Then
count = 0
Button1.Enabled = False
End If
 
You need to be more explicit when you explain what you want.

Your post indicated that you wanted the button disabled after a certain number of clicks. You didn't say that you wanted it to be reenabled later.

If that's the case, then you need another button to reenable the first button. You also need to reset the count variable back to 0.

Static count As Integer
count += 1
If count = 5 Then
count = 0
Button1.Enabled = False
End If

That works perfectly! Sorry that I didn't explain clearly enough, still a bit new to this forum and how help works in the programming field.

Thanks.

Here is the program I'm working on:

Program1.png
 
Back
Top