Results 1 to 8 of 8

Thread: difference in VB6 from Vb.net

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908

    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?

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    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.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908
    ok thanks alot!

  4. #4
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780
    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.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908
    so wat should i actually do if i want to pass a value from one form to other?

  6. #6
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780
    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.

  7. #7
    Addicted Member
    Join Date
    Apr 2002
    Location
    California
    Posts
    160

    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.
    Jason Moore

    Software Engineer, Database Architect, Web Designer

    (C#,VB/NET,ASP/NET,COLDFUSION,JAVASCRIPT,SQL)

    http://www.gatorstudios.com
    [email protected]

  8. #8
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    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
  •  



Click Here to Expand Forum to Full Width