It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

Help with lblMsg in VB 6

Moderator: dafunkymunky

Help with lblMsg in VB 6

Postby EntangledDesi on Wed Oct 07, 2009 5:15 pm

I help with how to get the main form of an application to display a student's name when the main form is first run after they enter their name into a standard dialog box.
EntangledDesi
 
Posts: 5
Joined: Mon Oct 05, 2009 5:56 pm

Re: Help with lblMsg in VB 6

Postby pachecf on Fri Oct 09, 2009 12:14 am

On form load event you can add:

lblStudentName.caption = inputbox("Enter your name: " )

As soon as the form loads the student will be prompted to enter his/her name and it will display the input to a label call lblStudentName
pachecf
 
Posts: 6
Joined: Thu Oct 08, 2009 8:18 pm

Re: Help with lblMsg in VB 6

Postby EntangledDesi on Fri Oct 09, 2009 5:46 pm

^^I don't need it to create another input box though..I already have a standard dialog box [input box] where they input their name..I need help with how to get the name they put in there when the application runs to display on the main form
EntangledDesi
 
Posts: 5
Joined: Mon Oct 05, 2009 5:56 pm

Re: Help with lblMsg in VB 6

Postby pachecf on Fri Oct 09, 2009 6:38 pm

What you probably want to do is to add a public variable.
1. add a module to your project
2. declare a Public variable

Public retStudentName as string
3. Store the value of the student input to that variable and you can use it anywhere in your project.

How to use:

retStudentName = inmputbox(“Student Name”)

Textbox1 = retStudentName
Msgbox (retStudentName)
lblStudentName.caption = retStudentName

anything = retStudentName

Even form.caption = “Application Name: “ & retStudentName

The best part is that this variable will hold the name of the student and it can be accessed by any form, subroutine, etc. in your project.

Note: I van't used VB6 for a long time. But if it's not Public try Global declaration.
pachecf
 
Posts: 6
Joined: Thu Oct 08, 2009 8:18 pm


Who is online

Users browsing this forum: No registered users and 7 guests