473,796 Members | 2,679 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing Form Objects Using Module Procedures

10 New Member
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.txtAg e.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
2 1695
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
"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
WestAussie
10 New Member
"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.Componen tModel.IContain er"
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

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

Similar topics

2
1454
by: MLH | last post by:
A97 allows separate procedures in a form module to share common label names. Access 2.0 would puke when that happened. For instance, if I had 2 procedures in an Access 2.0 form module with labels both named ERR_MyButton_Click, compiling loaded modules produced an error. I'm glad to see this is not the case in Access 97. Access 2.0 went so far as to disallow me from using the same line numbers in two different procedures of a form module....
6
7767
by: Carlos | last post by:
Hi all, I am trying to access a public field of another form class within the same namespace. The field is public, what is the best way to access it from a different class? I defined as private MyNameSpace.Form1 cForm1; and I am trying to use it later as TextBox.Text = cForm1.TextBox.Text;
3
1570
by: MrShovel | last post by:
I'm new to this ASP.NET caper and have the following questions. I have a TestObject that contains about 50 fields of data and 3 member procedures. Below is a simplified explanation of what I do. At the start of each session I initialise this TestObject. On entering every page I create a local TestObject and do this: TestObject = Session("TestObject")
9
2084
by: Christian Blackburn | last post by:
Hi Gang, I've had this happen with a couple of controls now, but my patience has worn thin. Can somebody tell me why I can read/write to most objects on my form from my module, but not when working with StatusBar.Text? Thanks in Advance, Christian Blackburn My Code: Public Class frmMain
7
2011
by: David | last post by:
Hi, I am having trouble with a form that I have loaded trying to access a procedure on the main form. The trouble seems to be that a Global Array that is declare in a Module is producing a Nullreference error when I try to call the procedure on the main form. ie. Module 1 contains
6
3683
by: Bob Alston | last post by:
I am looking for Access reporting add-in that would be easy to use by end users. My key focus is on selection criteria. I am very happy with the Access report writer capabilities. As far as development of reports, it is certainly fine in my book. But for end-users, with little experience or training, it would be nice to have an easy way to handle various selection criteria, perhaps with relatively stock reports. I see easy to use by...
14
3898
by: James Thiele | last post by:
I'd like to access the name of a function from inside the function. My first idea didn't work. >>> def foo(): .... print func_name .... >>> foo() Traceback (most recent call last): File "<stdin>", line 1, in ? File "<stdin>", line 2, in foo
1
3948
by: Donald Grove | last post by:
I am suddenly getting this message. It happens during code executed from a form module that calls a function stored in a standard module. I am working on a standalone pc with no network connection to anything. After this message, access closes. Then when I go back, all the module have been deleted from the form.\ MS error reporting sends me to a web page that says there isn't a fix for the problem and that I should get Access 2003 (I...
3
1485
by: Andy.I | last post by:
Hi I have a module where I put all my functions and sub procedures. How do I from the module best reference objects in other forms? I have a form with a datagrid, and in the module I have a procedure to fill this datagrid. The datagrid is called dg, the form frmEventMain Would this be correct:
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9535
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10465
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9061
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7558
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5453
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4127
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.