Results 1 to 10 of 10

Thread: Working with Listview...

  1. #1

    Thread Starter
    Fanatic Member khalik_ash's Avatar
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    724

    Working with Listview...

    hi


    i have a small dout...

    how do i refer the control of the other form...
    as we do in VB6.

    Code:
    if FRM_Main.TreeView.SelectedItem then
              .......
            ...........
    end if
    
    ' how do we do in VB.net

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Re: Working with Listview...

    like this :
    VB Code:
    1. Dim frm2 As New Form2()
    2. frm2.TextBox1.Text = "For example"

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Pirate you may want to explain a little better. That is true your code will allow you access to an instance of the control BUT on a new instance of the form, which may not be what he is looking for. Forms are objects in .NET so you need a reference to instance of the form that you want to use the controls on. This is a pretty common question and a search will probably give you lots of answers.

  4. #4

    Thread Starter
    Fanatic Member khalik_ash's Avatar
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    724
    Originally posted by Edneeis
    Pirate you may want to explain a little better. That is true your code will allow you access to an instance of the control BUT on a new instance of the form, which may not be what he is looking for. Forms are objects in .NET so you need a reference to instance of the form that you want to use the controls on. This is a pretty common question and a search will probably give you lots of answers.
    well Edneeis u are right... pirate code will create a new object and refe to it... where i am looking for a existing object....

    i did search in the form did not find any releated one...


  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    as soon as you create new instance of your form , you can access all of its controls .

  6. #6

    Thread Starter
    Fanatic Member khalik_ash's Avatar
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    724
    Originally posted by Pirate
    as soon as you create new instance of your form , you can access all of its controls .
    well my form object is already loaded....is there a way to refere to a loaded form....

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    The same applies too .

  8. #8
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    See this demo...
    Attached Files Attached Files

  9. #9

    Thread Starter
    Fanatic Member khalik_ash's Avatar
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    724
    Originally posted by Pirate
    The same applies too .
    how is so...with out creating a new instance.....

  10. #10
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    You can't access any other forms objs or members without first instantiating an obj unless the obj you are trying to access is static (shared) in this case you can directly use the obj in your code (no need to use New keyword).got it ?

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