Results 1 to 16 of 16

Thread: [RESOLVED] Inputted data into another form

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Location
    Scarborough
    Posts
    9

    Resolved [RESOLVED] Inputted data into another form

    i have to create this hangman type game for college and i'm a bit stuck on get data inputted by the player to be displayed onto another form.

    the player will input a clue to help with the guessing of the word (this is entered on one screen)
    and it needs to be displayed on another form, but i don't know how to do this could anyone help please.

    cheers James

  2. #2
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: Inputted data into another form

    Welcome to VBForums, James

    You can simply put a Label (name it for example "lblInput") on the second Form and display the input data like this:
    Code:
    secondFormName.lblInput.Caption = yourInputHere

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Location
    Scarborough
    Posts
    9

    Re: Inputted data into another form

    how would that work getting the data from a different form.

    i have a text box on one form where the player can input the clue, and it needs to be displayed on the game play form.

    sorry i only started using VB today lol and it all has to handed in tommorow

  4. #4
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: Inputted data into another form

    Check this sample. Hope you understand it
    Attached Files Attached Files

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Location
    Scarborough
    Posts
    9

    Re: Inputted data into another form

    yeah that makes sense to me
    i attached the file with what i have up to now
    Last edited by DeadDude; Mar 29th, 2007 at 05:45 AM.

  6. #6
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: Inputted data into another form

    Btw... you don't need to use the "Load" expression everytime you're refering to some Form. Every call to some Forms method, function or property envokes the Form automatically so it's already loaded.

    Nice work for one day, though

  7. #7

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Location
    Scarborough
    Posts
    9

    Re: Inputted data into another form

    cheers
    i know i understood the sample you showed me which is probably the first thing i have understood all day but i'm still having a few problems in loading the clue up

  8. #8
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: Inputted data into another form

    If your "How to play" Form was finished i could help you with that...

    How do you want to use the "clue" and why does the word only have 6 letters?

  9. #9

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Location
    Scarborough
    Posts
    9

    Re: Inputted data into another form

    the game is only suppose to have 6-letters according to our tutor, don;t ask me why.

    the clue is supposed to be a hint to help guess the word which will be entered of the "frmWordClue"

    then when you click on the "click to play" button it is supposed to be displayed in the label which is under the title at the top of the page


    out of all the pages the "how to play" form is the easiest but want to get the rest done first lol
    when i've done the clue part i have to start on the drag and drop side of the game :S

  10. #10
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: Inputted data into another form

    Well... i/we 'll be glad to help you with some specific problem/s if you'll encounter some in the near future Good luck!

    If you concider this thread to be resolved then please pull-down the 'Thread Tools' menu and 'Mark Thread Resolved' so people will know you got your answer

  11. #11

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Location
    Scarborough
    Posts
    9

    Re: Inputted data into another form

    cheers for the help,
    but i think i may be doing something wrong as its not working

  12. #12
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: Inputted data into another form

    Quote Originally Posted by DeadDude
    cheers for the help,
    but i think i may be doing something wrong as its not working
    What exactly is that?

  13. #13

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Location
    Scarborough
    Posts
    9

    Re: Inputted data into another form

    i used the example to help me with the displaying of the clue on the game screen form but for some reason it won't display

  14. #14
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: Inputted data into another form

    Add the bold line:
    Code:
    Private Sub cmdClickToPlay_Click()
        Load frmGameScreen
        frmGameScreen.lblInput.Caption = EnterClue1.Text
        frmGameScreen.Show
        Unload Me
    End Sub
    Also, learn how to use Option Explicit in each of your modules (see my example). To use it in your every module by default, go to menu Tools>>Options>>Editor>>... and tick Require Variable Declaration.

  15. #15

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Location
    Scarborough
    Posts
    9

    Re: Inputted data into another form

    cheers that worked fine fanx

    fanx for the help dude

  16. #16

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