|
-
Jan 21st, 2004, 09:22 AM
#1
Thread Starter
Fanatic Member
difference in VB6 from Vb.net
i find it funny that there is this difference of vb6 from .net.In vb6 i can easily get the data key in by user to be shown on the next form....eg: lblxxx.caption=form1.txtYYY.text
where lblxxx is from form2 .....
However in .net this dont apply...and i have yet to find a way to do it.... i try to use :
Dim OpentheForm1 As New form1
lblxxx.caption = "Welome" & OpentheForm1.txtLogin.Text
but still don work...(can only see the welcome...) can anyone pls advice?
-
Jan 21st, 2004, 09:25 AM
#2
Frenzied Member
I've read that there is a way to reference controls on other forms (so it says in "Mastering Visual Basic.Net"), but haven't read that chapter yet. If I remember, I'll look it up when I get home, unless someone else posts the answer first.
-
Jan 21st, 2004, 09:27 AM
#3
Thread Starter
Fanatic Member
-
Jan 21st, 2004, 11:47 AM
#4
There are loads of differences between .net and vb6. You should know this from all 3 threads you posted asking the same question .
The reason your getting nothing back, is that you have never typed anything into the textbox. When you have done this:
Dim OpentheForm1 As New form1
It creates a NEW form, so it wont have anything in it.
Where do you show it to the user ? Thats where you need to read the values.
You probly keep thinking that Form1 is just Form1 wherever you want to use it. But its an INSTANCE of the form1 and if you want to keep using it, you need to keep a reference to it.
-
Jan 21st, 2004, 12:27 PM
#5
Thread Starter
Fanatic Member
so wat should i actually do if i want to pass a value from one form to other?
-
Jan 21st, 2004, 12:33 PM
#6
http://www.vbforums.com/showthread.p...84#post1600084
Ive included an example in this post to the same question, the only difference is that it uses a listbox instead of a text box.
It just shows 2 ways of asking for data from another form.
In answer to your question, it would depend on what you have already done. If this example doesnt help, you will need to post something that has your setup (if its not too big) or I will create another simple example based on how you want it to work.
-
Jan 21st, 2004, 03:50 PM
#7
Addicted Member
Differences in VB6 and .NET
You probly keep thinking that Form1 is just Form1 wherever you want to use it
SOLID!
By far i think .NET surpasses VB6 in every dimension.
-
Jan 21st, 2004, 08:16 PM
#8
PowerPoster
Hi,
"However in .net this dont apply...and i have yet to find a way to do it.... i try to use :
Dim OpentheForm1 As New form1
lblxxx.caption = "Welome" & OpentheForm1.txtLogin.Text
but still don work...(can only see the welcome...) can anyone pls advice?"
Your above code works perfectly well. As grimfort said, obviously there must be some text in form1.txtLogin before you can add it to the word "Welcome". Did you enter text into it when you designed it or does it receive it's first text during runtime?
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|