Results 1 to 10 of 10

Thread: Please Help!!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    240

    Lightbulb

    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)


  2. #2
    Hyperactive Member Sacofjoea's Avatar
    Join Date
    May 2000
    Location
    Never Never Land
    Posts
    472
    How about 2 text boxes??

  3. #3

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    240

    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)


  5. #5
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    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

  6. #6
    Hyperactive Member
    Join Date
    May 2000
    Posts
    344

    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
    -RaY
    VB .Net 2010 (Ultimate)

  7. #7
    Hyperactive Member
    Join Date
    May 2000
    Posts
    344

    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!


    -RaY
    VB .Net 2010 (Ultimate)

  8. #8
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    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.

  9. #9
    Hyperactive Member
    Join Date
    May 2000
    Posts
    344

    Hehhe

    Im a dinosaur...still using vb3, so had to create my own....sucks doesnt it
    -RaY
    VB .Net 2010 (Ultimate)

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    240

    Wink 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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width