By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,203 Members | 695 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,203 IT Pros & Developers. It's quick & easy.

Accessing Form Objects Using Module Procedures

P: 10
Hello

This is my first attempt at using VB .NET, and I'm having some trouble identifying the correct means by which to access a form using a procedure stored within a module.
I've been using VBA in Excel (self taught) where for example I could access a forms textbox using the statement 'frmInput.txtAge.Text'.

In my .NET project I have created a form with a textbox but have been unable to access it from a module using the same process. I've tried searching various groups but so far have not found the answer (or through my limited understanding seen it and not realised).

How do you access form objects in .NET from a module?

Thanks for your help.
Oct 5 '07 #1
Share this Question
Share on Google+
2 Replies

Shashi Sadasivan
Expert 100+
P: 1,435
"From a module" does that mean a form or a class which has invoked a form, and you are trying to get the control within that invoked form?

If that is the case, then by default all controls are added as private....you would have to change its modifier value to public and you can do what you intend to do from the moduke.

cheers
Oct 5 '07 #2

P: 10
"From a module" does that mean a form or a class which has invoked a form, and you are trying to get the control within that invoked form?

If that is the case, then by default all controls are added as private....you would have to change its modifier value to public and you can do what you intend to do from the moduke.

cheers

Thank you Shashi for your help.

I had created a windows application from the installed templates, then added a module and was trying to access the forms objects via procedures in the module.
After I found " 'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer"
and changed private to public as you suggested, accessing the form objects worked fine the way I have been used to.

Thanks again for your help.
Oct 9 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.