-
I have a textbox and a command button,i want to be able to clear the text box message when i click the command button ..and then have another message appear when the previous message disappears..i want to accomplish this by using just one textbox and just one command button...
Thanks :0)
-
-
Put this code in your command button.
Text1.Text = ""
Text1.Text = "This is the new text"
-
Thanks for the reply..
Thanks for replying too you both..but i can accomplish it with two text boxes..
but i want to do it with just one textbox and one command button
Martinliss: I Tried that code already,but when ever i use it , the event procedure for the button just prints the last text that was entered
Here's how i sort of accomplish this ..
Private Sub Form_Load()
Text1.Text = "My First message"
End Sub
Private Sub Command_Click()
Text1.Text = ""
Text1.Text = "My Second Message"
Text1.Text = "My Third Message" <-------The Program Just ignores The Second
Text1.Text and inputs the third one!
I know it is possible to do what i want becuase i have a keygenerator that was made with visual basic and it changes the text in the text box with only one button.
But in any case, thanks
:0)
-
Sophtware,
Try this code in the command button:
Code:
Static ncount As Integer
Select Case ncount
Case 0
Text1.Text = "Message2"
Case 1
Text1.Text = "Message3"
End Select
ncount = ncount + 1
Hope this helps
-
I Can Help
Basically you want a pause, function.... However Visual Basic Doesn't have one, but it can be easily created.
Create a Module, and place this code in it.
Sub Pause (duratn As Integer)
Let curent = timer
Do Until Timer - curent >= duratn
DoEvents
Loop
End Sub
Now you can pause for a certain amount of seconds when ever you want.
Example: Pause(1)
would pause for 1 second.... Now just place this between, text2.text and text3.text...
Hope that helps
-
PS
Try to make Module for this command by itself, if not possible make sure there is no Option Explicit in the module or this would not work....
PSS
Text1.Text = ""
Text1.Text = "My Second Message"
Pause(2)
Text1.Text = "My Third Message" <-------The Program Just ignores The Second
Text1.Text and inputs the third one!
-
fallnwrld: Your right, VB doesn't have a Pause function, but it does have a Wait API.
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
So Wait(2000) will pause the code for 2 seconds.
-
Hehhe
Im a dinosaur...still using vb3, so had to create my own....sucks doesnt it
-
Thanks!
Thanks for all of your help...i dont know how to use modules yet so i am going to have to read that section in my textbook.
Thanks :0)