»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 09-20-2003, 12:46 PM   #1 (permalink)
Registered User
 
firewolf's Avatar
 
Join Date: Aug 2003
Location: Canada
Posts: 197
firewolf is on a distinguished road
Send a message via ICQ to firewolf
VB .NET variable help

Does anyone know how to set a variable so that it relates to a textbox?

For example:
Code:
Dim TextBoxNumber As Integer
now you can set/add/change that number globally or locally, but I need a line of code that Dim's a variable as text in a textbox...

For example:
Code:
Dim num1 As TextBoxNumber.Text
Does anyone understand what I'm talking about? It's hard to explain.

See, what I'm doing is creating a game and I want the users to be able to enter their name in and it will be displayed each time it's their turn.

How would I go about doing this?

firewolf is offline   Reply With Quote
Old 09-24-2003, 04:31 AM   #2 (permalink)
Registered User
 
nishark's Avatar
 
Join Date: Aug 2002
Location: Downunder
Posts: 427
nishark is on a distinguished road
i havent programmed in VB, but i've programmed in asp.net and C#. here's what i'd do:

drag and drop a textbox in the webform:
or hardcode it as follows ...
<asp:textbox id=playerName runat="server"></asp:textbox>

and in the codebehind:

string playerNameStr = playerName.Text();
Session.Add("playerNameStrSessionVar", playerNameStr);


and then retrieve it by:
session["playerNameStrSessionVar"].ToString();



relevant System inclusions will be needed ...
hope that helps...
nishark is offline   Reply With Quote
Old 09-24-2003, 05:07 AM   #3 (permalink)
Guest
Guest
 
Posts: n/a
You'd probably want to set a global variable that you can assign in a function you call when you need to get the name.

If I follow what you mean, it should just be:

Dim sText as String

And then in the function to collect the info you'd have

function ToGetName()

sText = formName.TextBox.Text

End

Then to display it, you'd just use the variable sText. Example:

MsgBox "This is where the " & sText & " name would go."


That help at all?
  Reply With Quote
Old 09-24-2003, 08:02 AM   #4 (permalink)
Registered User
 
firewolf's Avatar
 
Join Date: Aug 2003
Location: Canada
Posts: 197
firewolf is on a distinguished road
Send a message via ICQ to firewolf
Yes! Thanks a lot!
firewolf is offline   Reply With Quote
Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 05:19 AM.