Results 1 to 4 of 4

Thread: NewBie .. how to use object of the other form

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784

    NewBie .. how to use object of the other form

    Dear The Expert,

    With VB6 .. We can use / get the value of object from other form.. (eg. I want to get the value of textbox.text on Form1, I use Form1.Textbox1.Text) .. how about in VB.NET? .. I need to use the sqldataadapter object on Form1 .. how to do this...? please advice .. thank you

    Regards
    Winanjaya

  2. #2
    Lively Member ayan's Avatar
    Join Date
    Jan 2004
    Posts
    112
    VB Code:
    1. dim f as new form1()
    2. dim s as string=f.textbox1.text
    provided that textbox1 is a public member of form1. is this what u want? if not, sorry

  3. #3
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    Re: NewBie .. how to use object of the other form

    Originally posted by Winanjaya
    Dear The Expert,

    With VB6 .. We can use / get the value of object from other form.. (eg. I want to get the value of textbox.text on Form1, I use Form1.Textbox1.Text) .. how about in VB.NET? ..
    Regards
    Winanjaya
    Several ways. Have a search of this forum for several posts.

    Easiest is in a module:

    Public frm1 as New Form1
    Public Sub Main
    Application.run(frm1)

    In Form1

    Dim frm2 as New Form2

    You can then access any object or method of Form1 by prefacing your code for example.

    frm1.TextBox1
    Last edited by taxes; May 24th, 2004 at 05:45 AM.
    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.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784
    but if we use the statement below:

    dim f as new form1

    this will call form1 twice .. because form1 is as startup form.. any idea?

    TIA

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