Results 1 to 8 of 8

Thread: Newbie needs some help =(

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    21
    hi,
    I am new to VB and I want to create a very simple programme which does the following..
    When you type in a piece of text, a pop-up says something about what you entered e.g Say I typed in Hi, a pop-up would say hello. If i type in, booyakasha, a pop-up would say..... erm..
    please help

  2. #2
    Guest
    mhh...
    one way would be to use the select case function

    place a textbox and a commandbutton at you're form, and paste the following code into form1
    Code:
    Private Sub Command1_Click()
    Select Case Text1.Text
        Case "hi"
            MsgBox "Hello"
        Case "booyakasha"
            MsgBox "...erm.."
        Case "vb"
            MsgBox "Visual Basic"
        Case Else
            MsgBox "=)"
    End Select
    End Sub
    hope that helps...
    taLON

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    21
    thanks very much! I a have so much trouble with VB compaired to C++.

    Maybe I should stick so my HTML and javas =(

  4. #4
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    if you put:
    Option compare Text
    as the first line in the declarations section of your form, the user can enter UPPER or lower case and the select statement will still evaluate correctly
    Mark
    -------------------

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    21
    cheers for the help,

    there I have problems with the code as when I add extra cases, It won't see the others... is this because of the indenting or something?

    [Edited by JonTaylor on 03-24-2000 at 05:31 AM]

  6. #6
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    case else should be the very last one
    You haven't left it in half-way down by any chance??
    Mark
    -------------------

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    21
    no i'm not that silly =Þ

    I have it exaclty like the one shown but i added some more, i shall post the code

    O wait it appears to be working now, the I fiddles with the posistioning of the Cases...

    cheers =)

    [Edited by JonTaylor on 03-24-2000 at 05:56 AM]

  8. #8
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    yes!

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