Computing.Net > Forums > Programming > InputBox help in VB.net 2003

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

InputBox help in VB.net 2003

Reply to Message Icon

Name: Tysoe
Date: January 28, 2007 at 15:52:18 Pacific
OS: XP Pro SP2
CPU/Ram: Pentium 4 3.0 Ghz/ 1024 M
Comment:

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 String

message = "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



Sponsored Link
Ads by Google

Response Number 1
Name: StuartS
Date: January 28, 2007 at 16:27:30 Pacific
Reply:

Try frmTaskA.Caption = myValue


Stuart


0

Response Number 2
Name: FBI Agent
Date: January 29, 2007 at 23:39:27 Pacific
Reply:

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.


0

Response Number 3
Name: Tysoe
Date: January 30, 2007 at 06:52:44 Pacific
Reply:

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.


0

Response Number 4
Name: Tysoe
Date: January 30, 2007 at 10:49:40 Pacific
Reply:

Worked it out:

Dim message, title, myvalue As String

message = "Enter Your Name"
title = "Task A"

myValue = InputBox(message, title)
Me.Text = myvalue

-------------------------
:)


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Java sdk question pc timer



Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: InputBox help in VB.net 2003

windows media player in vb.net www.computing.net/answers/programming/windows-media-player-in-vbnet/9725.html

need help in vb.net www.computing.net/answers/programming/need-help-in-vbnet/5974.html

call method written in VB.NET from www.computing.net/answers/programming/call-method-written-in-vbnet-from-/7816.html