VB.Net Adding Text from one place to another  | | |
October 4th, 2002, 03:36 AM
|
#1 (permalink)
| | Ordained Mommy
Join Date: Oct 2001 Location: Big Sky Country
Posts: 4,259
| 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.
|
| |
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!! |
| |
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... |
| |
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.
|
| |
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! |
| |
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  |
| |
October 4th, 2002, 11:13 PM
|
#7 (permalink)
| | Ultimate Member
Join Date: Feb 2002 Location: midvale, utah
Posts: 2,310
|
I am not sure, but look where my mouse is, is that what you were talking about, where you label. |
| |
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  |
| |
October 5th, 2002, 07:13 PM
|
#9 (permalink)
| | Ordained Mommy
Join Date: Oct 2001 Location: Big Sky Country
Posts: 4,259
|
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.  |
| |
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 |
| | | Thread Tools | Search this Thread | | | | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |