home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

VB.Net Adding Text from one place to another

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1741
Discussions: 200,924, Posts: 2,379,110, Members: 246,290
Old October 4th, 2002, 03:36 AM   Digg it!   #1 (permalink)
Ordained Mommy
 
NeoStarO1's Avatar
 
Join Date: Oct 2001
Location: Big Sky Country
Posts: 4,259
Blog Entries: 1
VB.Net Adding Text from one place to another

I am stumped on one last final part of my lab here.

What I got is, Big Lable box that has "This is a" set in there, Then below that I have text box a user can type in. then next to that text box I have a button. That button's function is to add the word user typed into the text box and add or append it to the label box that has the "this is a".

so if user typed in word "Sentence, The output would show.

This is a sentence.

Does this make sense? Now I can't for the life of mee figure out how to Add stuff. This chapter hasn't talked about how to code to add things.

If im Not clear just say so. and I'll try to explain again.







OH Vass, I bet you will be the one to answer this.


Edit: Dang he logged off as I was typing this up.

Last edited by NeoStarO1 : October 4th, 2002 at 03:41 AM.
NeoStarO1 is offline   Reply With Quote
Old October 4th, 2002, 08:33 PM     #2 (permalink)
Senior Member
 
Join Date: Oct 2001
Location: Alberta, Canada
Posts: 563
if I understand correctly...


try the 'caption' property!!


but, is this vb.net? and if so, is "Big Label" a new intrinsic control?? vb6 it was just plain ol' Label...



g'luck!!
^hyd^ is offline   Reply With Quote
Old October 4th, 2002, 09:04 PM     #3 (permalink)
Senior Member
 
Join Date: Oct 2001
Location: Alberta, Canada
Posts: 563
geees... just re-read the thread title... looks like it is vb.net... not so sure my suggestion will help(F1) then...
^hyd^ is offline   Reply With Quote
Old October 4th, 2002, 09:21 PM     #4 (permalink)
Not Really a Member
 
Join Date: Oct 2001
Posts: 25,384
you could set it like such...

label1.text = label1.text & txtTextbox


however!!
That won't work if you do more than one iteration of it...
so the easiest thing to do would be to put

label1.text = "This is a " & txtTextbox


-- edit --
Note:
You can no longer put
label1 = "Some text"
vb.net does not have default properties so you will have to put label1.Text

__________________
Helicopters don't fly; they vibrate so much and make so much noise that the earth rejects them.
vass0922 is online now   Reply With Quote
Old October 4th, 2002, 10:47 PM     #5 (permalink)
Senior Member
 
Join Date: Oct 2001
Location: Alberta, Canada
Posts: 563
So, in vb.net, does a Label now have a "text" property instead of "caption"?

In VB6 it is "caption" to change the content on a Label, and there is no "text" property.

Me thinks it's time to order that 30-day trial of VB.net!!

ciao!
^hyd^ is offline   Reply With Quote
Old October 4th, 2002, 11:07 PM     #6 (permalink)
Not Really a Member
 
Join Date: Oct 2001
Posts: 25,384
yeah there's a few little quirks like that ...
Takes a little while to find your way around, but not bad.
The hardest thing to get used to is finding everything nwo that its all in namespaces.
For instance to find a file IO method you have to do either

dim stuff as System.IO.File

OR at the top you can use

Using System.IO

then in the procedure you can just do
dim stuff as File
vass0922 is online now   Reply With Quote
Old October 4th, 2002, 11:13 PM     #7 (permalink)
Ultimate Member
 
Jeordiewhite's Avatar
 
Join Date: Feb 2002
Location: midvale, utah
Posts: 2,310
Send a message via ICQ to Jeordiewhite Send a message via AIM to Jeordiewhite Send a message via Yahoo to Jeordiewhite
I am not sure, but look where my mouse is, is that what you were talking about, where you label.
Attached Thumbnails
vbulletin-net-adding-text-one-place-another-vb.net.jpg  
Jeordiewhite is offline   Reply With Quote
Old October 5th, 2002, 02:00 AM     #8 (permalink)
Not Really a Member
 
Join Date: Oct 2001
Posts: 25,384
same property, different control Jeordie
What she means by a label is *typically* static text on the Form... you're pointing to the text property of a command button
vass0922 is online now   Reply With Quote
Old October 5th, 2002, 07:13 PM     #9 (permalink)
Ordained Mommy
 
NeoStarO1's Avatar
 
Join Date: Oct 2001
Location: Big Sky Country
Posts: 4,259
Blog Entries: 1
No i don't think so,

What i was trying to accomplish is that on the form, in run mode, User types in word in text box. then user clicks on button to add word. This will take what the user typed in the text box and append it to the end of the top most lable box. Meaning I need to get whatever the user types in and when they click on the button it appends it to the end of a sentense in a label box.

This excersises asked us to use a lable, granted be easier if it was text box but that is besides the point of the lesson.

Does that make sense now? I'll do some screen shots later, was just check email and forgot about this thread.
NeoStarO1 is offline   Reply With Quote
Old October 5th, 2002, 07:31 PM     #10 (permalink)
Not Really a Member
 
Join Date: Oct 2001
Posts: 25,384
Umm I think it makes sense just fine...

Ok here' the way I understand it

you have
Label1
Text = "This is a "

text box
Text = <user enters this data>

Command button to execute the action

Public sub CmdButton.Click event (not the exact text, just trying to represent this code would go into the commadn button click event

label1.text = "This is a " & txtTextbox.Text


End Sub

What you want is to have
label1.text = label1.text & txtTextbox
that will append the text from the text box to the text of the label
The PROBLEM with that is

the first time you click it
label1.text = "This is a "
Say the user entered
"test" in the text box
So you would end up with
"This is a test"

NOW the NEXT time you click it because youre appending text to the existing label
If the user puts in "second test"
When you hit the command button you'll get
"This is a testsecond test"

That is why I suggested using
Label1.Text = "This is a " & txtTextbox.Text

or am I clear as mud?! lol
vass0922 is online now   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (2858)
Obama the Muslim (14)
Why is Khalid Sheikh Mohammed even .. (9)
windows vista security holes (9)
Is the PSU I received dead? (10)
Foreign voltage (10)
HIS HD5770 graphic card question (15)
Print spooler problem (13)
Install XP pro and a Vista laptop ?.. (9)
Dept. of HS: NSA 'Helped' Develop V.. (15)
A good PSU? (10)
New Computer wont recognize XP disc (7)
Ideal cheap graph card for PC-Gamin.. (15)
EVGA 9800 gtx help with finding a g.. (8)
Recent Discussions
Optical Audio A-B Switch (0)
windows vista security holes (9)
Fire in DVD (0)
radeon x850xt platinum & shader 3 (2)
The NTDVM CPU has encountered an ille.. (24)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (34)
Wireless speakers for PC? (11)
Print spooler problem (13)
Help getting around port 80 for camer.. (2)
Display shows 3x5 inch in middle of s.. (3)
monitor will not turn on at all, (1)
World's largest Monopoly Game using G.. (331)
Foreign voltage (10)
FiOS modem/router interfering with ne.. (7)
Browsers wont load websites (2)
Virus Doctor Popup? (1)
Dept. of HS: NSA 'Helped' Develop Vis.. (15)
Install XP pro and a Vista laptop ?? (9)
EVGA 9800 gtx help with finding a goo.. (8)
Modern Warfare For the PC (32)
Problem with speed step/turbo boost? (1)
Modern Warfare 2: Who Bought It? (61)
SIS 740 and Widescreen (8)
Baffling Problem with my CPU/MoBo's. .. (0)
HIS HD5770 graphic card question (15)


All times are GMT -4. The time now is 10:51 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28