CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11
  1. #1
    Join Date
    Oct 2004
    Posts
    6

    Exclamation *HELP* Beginner: Loops and textboxes

    *HELP* Beginner! Simple VB6 questions that I can't solve!
    --------------------------------------------------------------------------

    Hey guys,

    I've been working with VB for a while now but I can't get loops to work with textbox's; is this possible?

    Here's my code that won't work:

    Private Sub cmdStart_Click()

    a = 5
    y = " test"

    Do Until a = 1

    Text1.Text = a & y

    Loop

    End Sub

    ----------------------

    I'm trying to make it so it will count down in the textbox but it's not working.
    I can get it to work with the picture box but something else interfered with that aswell.

    Another question is with the text-to-speech component, is it possible to get it to speak whatever is printed into the picture box?

    I know it's possible to get the text-to-speech to read whats in the textbox but I can't get the loops to work in the text box!!!

    To get the speech to work with a textbox I have to type in...

    "spkSpeak.speak text1.text"

    Please help! thanks.

  2. #2
    Join Date
    Sep 2004
    Location
    Sandhem, Sweden
    Posts
    20

    Post Re: *HELP* Beginner! Simple VB6 questions that...

    Hi.

    Regarding your first question, try changing your code to this instead.

    Code:
    Private Sub cmdStart_Click()
        a = 5
        y = " test"
    
        Do Until a = 1
            Text1.Text = a & y
           a = a - 1
        Loop
    End Sub
    Regards,
    Michael

  3. #3
    Join Date
    Oct 2004
    Location
    Australia, Yeppoon
    Posts
    44

    Re: *HELP* Beginner! Simple VB6 questions that...

    I agree, that should fix the problem.
    Sorry if I am changing the topic but can you tell me more about the speak code, that could be very useful in my school project I am doing atm.
    thx

  4. #4
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: spkSpeak.speak text1.text

    see if this can help you:
    put
    spkSpeak.speak text1.text
    under change event of text box,
    may be conditioned to get the enter key
    or under the
    Validate event of textbox
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  5. #5
    Join Date
    Oct 2004
    Posts
    6

    Re: *HELP* Beginner: Loops and textboxes

    YIKES! that's what I forgot! haha ... i knew that *wink*

    Thanks alot.

    My objective is to get the text to speech read what's in the text or picture box.

    While in the text box or picture, it's looping numbers while I concatinate lyrics next to the looping variable.


    I'm going to make the program basically sing a long song that repeats itself but with changing variables.

    Ex. "The song that never ends..."
    "99 bottles of beer on the wall..."



    Thanks guys...I'll try and finish this program today and get back you guys! should be fun.

  6. #6
    Join Date
    Oct 2004
    Posts
    6

    Re: *HELP* Beginner: Loops and textboxes

    Well, I got the loop to work...

    Next challenge is the text...what I want to do is have like a sing along caption going with the voice.

    I have accomplished this with the picture box but it's going to be challenging with the textbox.

    There's 2 ways I have thought of...

    1: Having the lyrics to stay and the numbers to change.

    ex. 5 bottles of beer on the wall,
    5 bottles of beer,
    you take one down, pass it around,
    4 bottles of beer on the wall...

    *Thing is! I can't get it to print text line by line even setting the properties to multiline(true)

    Here's the code i've tried for this:

    Other parts of the code
    Text1.Text = i & a
    Text1.Text = i & b
    Text1.Text = c
    Text1.Text = i & a
    Other parts of the code

    2: Having the line change as the song processes...
    Ex. 5 bottles of beer on the wall
    (Then that line erases)
    5 bottles of beer!...
    (Erases and keeps looping down)
    Note: must create some sort of delay...I've gotten a delay to work with the picturebox but it wont work with the textbox!

    I've created a fake variable to stall time:
    (This is what i've put when I tried to make this program with a picbox)

    Do until x = 10000000
    x=x+1
    Loop

    This enabled me to set the time for when the numbers changed for the first example...
    ----------------------------------
    Can anyone help or have any ideas? Would REALLY appreciate it!

  7. #7
    Join Date
    Oct 2004
    Posts
    6

    Red face Re: spkSpeak.speak text1.text

    Quote Originally Posted by Cimperiali
    see if this can help you:
    put
    spkSpeak.speak text1.text
    under change event of text box,
    may be conditioned to get the enter key
    or under the
    Validate event of textbox

    I'm not sure what you mean...I got the speech to work to read whatevers in the text though..

    I wonder if it's possible to read whatever occurs in the picture box *scratches head*

  8. #8
    Join Date
    Sep 2004
    Posts
    292

    Re: *HELP* Beginner: Loops and textboxes

    Do you know how to change the 'pitch' or whatever its called of the text-to-speech component? It seems robotic, I want it to be more humanly or natural.

  9. #9
    Join Date
    Oct 2004
    Posts
    6

    Re: *HELP* Beginner: Loops and textboxes

    Yes, click on the "mouth" then configure the pitch in its property...

  10. #10
    Join Date
    Sep 2004
    Posts
    292

    Re: *HELP* Beginner: Loops and textboxes

    Thanks vigger, I'll try that one.

  11. #11
    Join Date
    Oct 2004
    Posts
    6

    Re: *HELP* Beginner: Loops and textboxes

    can anyone helpppp me?....

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

Featured