How do you pass from obj from one form to a module/forms 
Author Message
 How do you pass from obj from one form to a module/forms

In VB6 you were able to pass an obj from one form and give it a value in a
module and/or other form

in VB 6 the code was  form1.textbox.text = form2.textbox4.text

Now How do you do this in VB.Net

Thanks



Mon, 09 Aug 2004 07:30:40 GMT  
 How do you pass from obj from one form to a module/forms
Hi,
In VB.NET you have declare objects of the form types.
Dim f1 as new Form1()
Dim  f2 as new Form2()

If you want to access one form in another you can do it as follows:
- Create a constructor in second form that accepts first form type as
parameter. Then set some local variable to the passed value.
- Make form variables global to the application so that you can access them
from any form.

Thanks.
Bipin Joshi
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Software Developer | Author

http://www.bipinjoshi.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Quote:
> In VB6 you were able to pass an obj from one form and give it a value in a
> module and/or other form

> in VB 6 the code was  form1.textbox.text = form2.textbox4.text

> Now How do you do this in VB.Net

> Thanks



Mon, 09 Aug 2004 08:41:22 GMT  
 How do you pass from obj from one form to a module/forms
Hi,
In VB.NET you can achieve the desired result by passing an instance of a
form to a module and setting the forms properties or accessing forms
controls from it.
Following code will make things clear

Form1 with TextBox1, Button1

Quote:
>>Set TextBox1 Modifiers property to "Public"
In button click
>>SetFormText(Me)

In Module
Sub SetFormTextBox(ByRef o As Object)
o.TextBox1.Text = "From Module"
End Sub

This code will change the value of textbox1.text property of the passed form
to "From Module"

Hope this helps you.
Regards,
Manish Mehta
http://www.dotneteXtreme.com


Quote:
> In VB6 you were able to pass an obj from one form and give it a value in a
> module and/or other form

> in VB 6 the code was  form1.textbox.text = form2.textbox4.text

> Now How do you do this in VB.Net

> Thanks



Mon, 09 Aug 2004 11:28:14 GMT  
 How do you pass from obj from one form to a module/forms
Hi,

It can be any of the following
* The form or module can receive the Object ref. in the constructor or in a
method call.
eg:

Sub SetData(ByRef o as Form)
Form1 frm = Ctype(o,Form1)
frm.txtName.Text="abc"
' here txtName is a textbox in Form1
End Sub

* In Form1 u could define shared or instance level properties that can be
accessed in a module or another form

Sub SomeMethod()
Dim o as new Form1()
o.txtName="Abc"
o.Show()
End Sub

Sub SomeMethod()
dim o as Form1
o.SharedProperty ="Abc"

End Sub

Regards
Akila
http://www.synergetics-India.com


Quote:
> In VB6 you were able to pass an obj from one form and give it a value in a
> module and/or other form

> in VB 6 the code was  form1.textbox.text = form2.textbox4.text

> Now How do you do this in VB.Net

> Thanks



Mon, 09 Aug 2004 13:40:06 GMT  
 How do you pass from obj from one form to a module/forms
I think this discussion is already there in the forum previously.


Quote:
> In VB6 you were able to pass an obj from one form and give it a value in a
> module and/or other form

> in VB 6 the code was  form1.textbox.text = form2.textbox4.text

> Now How do you do this in VB.Net

> Thanks



Mon, 09 Aug 2004 14:39:44 GMT  
 How do you pass from obj from one form to a module/forms
already discussed previoulsy several times. check the earler discussions.
they are useful.
santu


Tue, 10 Aug 2004 18:41:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Pass variable form module to a form

2. passing forms and controls so I can set focus back to a form from a module

3. passing forms and controls so I can set focus back to a form from a module

4. Passing input box value from Form Module to report module

5. load another form form one form

6. Forms Collection: Using it to Open Forms by Passing the Form Name as a String Variable

7. passing focus info form form to form

8. Passing Value from Module Function to Form sub problem

9. Module works, except when form passes arguements

10. Passing a Form name to a module

11. Passing a form to a sub in a module

12. passing a form to a module

 

 
Powered by phpBB® Forum Software