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
Printable View
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
like this :
VB Code:
Dim frm2 As New Form2() frm2.TextBox1.Text = "For example"
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....Quote:
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.
i did search in the form did not find any releated one...
:(
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....Quote:
Originally posted by Pirate
as soon as you create new instance of your form , you can access all of its controls .
The same applies too .
See this demo...
how is so...with out creating a new instance.....Quote:
Originally posted by Pirate
The same applies too .
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 ?