473,805 Members | 2,266 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

access frmMain code

Lou
How do I access a property of a control that is part of frmMain from a
class?
Example:

Public Class myClass

Public ReadOnly Property DWidth() As Integer

Get

DWidth = frmMain.myObjec t.Width

End Get

End Property
Nov 21 '05 #1
2 1538
Hi Lou,

For this, first you'll need to create an instance of frmMain class in your
myClass. Here is an example:

Dim myfrm As New frmMain

Public ReadOnly Property DWidth() As Integer

Get

DWidth = frmMain.myObjec t.Width

End Get

End Property

This should work.

Thanks

Mona [GrapeCity]

"Lou" <lo********@com cast.net> wrote in message
news:OZ******** ******@TK2MSFTN GP10.phx.gbl...
How do I access a property of a control that is part of frmMain from a
class?
Example:

Public Class myClass

Public ReadOnly Property DWidth() As Integer

Get

DWidth = frmMain.myObjec t.Width

End Get

End Property

Nov 21 '05 #2
"Mona" <mo**@discussio ns.com> schrieb:
For this, first you'll need to create an instance of frmMain class in your
myClass.


I don't think that this will solve the problem. Instead, it's better to
pass a reference to the existing instance of the main form to the class (in
a property or method parameter, for example).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
7549
by: Michael Ramey | last post by:
How can controls on a Windows Form be accessed (or referenced) from another Class? I know how to do it from another Form. The following doesn't work even though the Control Modifiers property is set to "Public": frmMain.myControl Thanks. Michael
7
1961
by: vbMark | last post by:
Here's my code: string strKeys; RegistryKey rk = Registry.CurrentUser; RegistryKey val = Registry.CurrentUser; string sLocation = "Software\\Microsoft\\Windows\\CurrentVersion \\Internet Settings\\P3P\\History"; rk = rk.OpenSubKey(sLocation); strKeys = rk.GetSubKeyNames(); for (int i = 0; i < strKeys.Length; i++)
12
4292
by: Dean Slindee | last post by:
My project has a main form (frmMain, the startup object for the project) and several other "child" forms that are painted within a large panel on frmMain. In each form's Form_Load event, a Weak Reference for that form is loaded into a global Hash table, like this: Dim wr As WeakReference = New WeakReference(Me, False) If Not hashTable.Contains(cfrmMain) Then
4
12286
by: bbdobuddy | last post by:
Hi, How do I open a Microsoft Access 2003 form from Visual Basic.net Thanks in advance bbdobuddy
2
5617
by: JamesB | last post by:
Hello, I have a (hopefully simple) problem. I have a form, lets call it frmMain, and this has a database connection object on it (sqlconnection) declared as public. All works well. One of the operations I want to do will occur on a second form (call it frmChild). I can open up this quite happily with
8
9644
by: Greg Strong | last post by:
Hello All, The short questions are 1 Do you know how to make DSN connection close in Access to Oracle 10g Express Edition? &/or 2 Do you know how to make a DSN-less pass-through query work from
9
2582
by: Greg Strong | last post by:
Hello All, What is the maximum length of an ODBC pass through query? Things work fine with the code except when I try to create a view which is pretty complex in Oracle. I'm using a DSN provided with the Oracle Express Edition and using Access 2k2 as the front-end. When I debug print the SQL and paste it into SQLplus it works fine. The length of the debug print that works is 1988 characters. Since the exact same code works with...
1
1808
by: Paez | last post by:
Hi there. How can I modify a form control property from another form. Let's say, I have a frmMain that has a ToolStripMenuItem with the current user info. Then, I open another form (frmChangeUser) and after I enter a password in that form, the current user will change and the frmMain ToolStripMenuItem will also change. Right now, I have the folowing code:
6
2426
by: Wesley Peace | last post by:
I hate to cross post, but I've gotten no answer yet on a problem I'm having with visual studio 2008. I've created a series of forms with controls to access a Access database tables. The connection string works fine and the tables are added to the project without a problem. When I create the tables they appear to bind and I am able to preview the data in the database in design mode; however, at runtime no data is displayed and the...
0
10614
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...
0
10363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10369
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
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7649
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
5544
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
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4327
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
2
3847
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.