Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Scenario:
When the program starts i want an inputbox to appear where the user inpyuts their name, which is then stored in a variable, which is then used to set the forms text property.This is what i have tried:
Dim frmTaskA As New frmTaskA
Dim message, title, myValue As Stringmessage = "Enter Your Name"
title = "Task A"myValue = InputBox(message, title)
frmTaskA.Text = myValue
-------------
This code puts the users name into the variable(myValue) ok but it deosn't set the name property of the form.This is obviously either the wrong way to do it or i'm missing something.
Any ideas?
Thanks

ummm... "name" property or "text" property? and my big question: what is all that business about creating a new instance of the form with the same name? that sounds like the error right there.
all that you need to do to change the text would be FORMNAME.text = "NAME YOU WANT"
and i dont see any errors besides that first line.

It's the Text property i want to change.
lol yeh i wasn't sure about that either but i that's what it said in the good ol' help files and without that declaration the text property doesn't appear in the list when i type
"FORMNAME."It come up with this error:
Reference to a non-shared member requires an object reference.Declaring a new instance of the form gets rid of that error and the user name goes is being stored in the variable correctly but the text property of the form is still blank.
I think it may be changes the text property of the wrong instance of the form and getting confused because i named it the same, i'll try changing that when i get home.
What i want to appear in the text property will be different each time which is why i need to use a variable instead of
FORMNAME.text = "whatever"Thanks for your input.

Worked it out:
Dim message, title, myvalue As String
message = "Enter Your Name"
title = "Task A"myValue = InputBox(message, title)
Me.Text = myvalue-------------------------
:)

![]() |
Java sdk question
|
pc timer
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |