473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Simple Windows Control Question

I'm just wondering how can i get the properties of the container that the
control resides on in vb6 is was quite simple.

I want to get the forms width and heigth

thanks
Nov 21 '05 #1
2 1008
The control has a Parent. There will be a chain of parent objects going
right back to the form so you can follow the chain back and get the
top-level containers propeties.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"David Gacek" <so*****@hotmail.com> wrote in message
news:e2****************@tk2msftngp13.phx.gbl...
I'm just wondering how can i get the properties of the container that the
control resides on in vb6 is was quite simple.

I want to get the forms width and heigth

thanks

Nov 21 '05 #2
To get the Form width and height:
From a sub within the form itself:
Me.Width, Me.Height

From outside the form:
(where frm is an instance of the form)
frm.Width, frm.Height

From outside the form:
(where ctl is an instance of the control)
ctl.parent.Width, ctl.parent.Height 'get the parent of the control
ctl.TopLevelControl.Width, ctl.TopLevelColntrol.Height

Haven't tried the following but it might work:
ctl.Container.Width, ctl.Container.Height

--
Dennis in Houston

"David Gacek" wrote:
I'm just wondering how can i get the properties of the container that the
control resides on in vb6 is was quite simple.

I want to get the forms width and heigth

thanks

Nov 21 '05 #3

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

Similar topics

3
by: kirk g | last post by:
When I run the following code: OleDbConnection conn = new OleDbConnection( @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\moneymakin.mdb"); String stmt = "INSERT INTO Person (FirstName,...
3
by: Peter | last post by:
Hello Thanks for reviewing my question. I would like to know how can I programmatically select a node Thanks in Advanc Peter
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
3
by: kirk g | last post by:
When I run the following code: OleDbConnection conn = new OleDbConnection( @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\moneymakin.mdb"); String stmt = "INSERT INTO Person (FirstName,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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...
0
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,...

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.