473,326 Members | 2,061 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,326 software developers and data experts.

Peculiar Control Behaviour

Here's a simple example of my problem...
Create a new Activex Control and just put a ComboBox on it.
Add a project and site the new Control.

Add this to the Form code. and run it.

**********************************************

Option Explicit

Private Sub UserControl_Initialize()
MsgBox "Initialize"
Combo1.AddItem "Hello"
End Sub

Private Sub UserControl_InitProperties()
MsgBox "InitProperties"
End Sub

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
MsgBox "ReadProperties"
End Sub

Private Sub UserControl_Resize()
MsgBox "Resize"
End Sub
************************************

I find it very curious that it does the Initialize event, then the Resize
event, then the ReadProperties event.

It seems that adding something to the ComboBox with AddNew does this.
When it's commented out it works like the docs say: Initialize event, then
the ReadProperties event, then the Resize event.

Am I not understanding something right, or is this not the right behaviour.
I guess the workaround must be to put this in the ReadProperties event?

I am using VB5, and have not made all that many controls.

Thanks for any help.
Jul 17 '05 #1
2 2439

"The Mess" <em***@none.com> wrote in message
news:PL********************@news20.bellglobal.com. ..
| Here's a simple example of my problem...
(snip)

| I find it very curious that it does the Initialize event, then the
Resize
| event, then the ReadProperties event.
|
| It seems that adding something to the ComboBox with AddNew does this.
| When it's commented out it works like the docs say: Initialize event,
then
| the ReadProperties event, then the Resize event.
|
| Am I not understanding something right, or is this not the right
behaviour.
| I guess the workaround must be to put this in the ReadProperties
event?
|

This appears to be true for any type of control on the user control.
Also, you don't have to actually change anything; merely inspecting a
property of a contained control will do it. I tried "If Line1.X1 = 7
Then", which also causes the Resize event to occur before the
ReadProperties event.

Evidently any reference to a contained control requires something to
happen that triggers the resize event. I am in VB6, so I am pretty sure
MS's response to this would be "This behavior is by design."

So, I would say, do not count on ReadProperties occuring before Resize,
unless you are willing to have Initialize not look at or touch anything.
What you do instead depends on what you need to do. By the way, normally
the size of the control is determined by the settings of the actual
control placed on a form.


Jul 17 '05 #2
Thanks for the info, Steve. That helps.
In fact I found a web site that tells me that constituant controls do not
yet exist during the Initialize event, so that sound like it!

"Steve Gerrard" <my********@comcast.net> wrote in message
news:Tv********************@comcast.com...

"The Mess" <em***@none.com> wrote in message
news:PL********************@news20.bellglobal.com. ..
| Here's a simple example of my problem...
(snip)

| I find it very curious that it does the Initialize event, then the
Resize
| event, then the ReadProperties event.
|
| It seems that adding something to the ComboBox with AddNew does this.
| When it's commented out it works like the docs say: Initialize event,
then
| the ReadProperties event, then the Resize event.
|
| Am I not understanding something right, or is this not the right
behaviour.
| I guess the workaround must be to put this in the ReadProperties
event?
|

This appears to be true for any type of control on the user control.
Also, you don't have to actually change anything; merely inspecting a
property of a contained control will do it. I tried "If Line1.X1 = 7
Then", which also causes the Resize event to occur before the
ReadProperties event.

Evidently any reference to a contained control requires something to
happen that triggers the resize event. I am in VB6, so I am pretty sure
MS's response to this would be "This behavior is by design."

So, I would say, do not count on ReadProperties occuring before Resize,
unless you are willing to have Initialize not look at or touch anything.
What you do instead depends on what you need to do. By the way, normally
the size of the control is determined by the settings of the actual
control placed on a form.

Jul 17 '05 #3

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

Similar topics

0
by: BestNews | last post by:
Hi All, I have peculiar problem. I Used ActiveX placed around 'n' number of such controls on the UserControl with AutoScroll feature enabled. Now scroll the vertical scrollbar thumb position say...
8
by: deko | last post by:
I'm hoping someone can sanity check my understanding of the Object Model for Forms/Controls. I'm having trouble drilling down into Control properties. First, I have a record set with the...
0
by: Rob Levine | last post by:
(This post also available at http://roblevine.blogspot.com/2004/11/frustrating-http-connection-behaviour.html in a slightly more readable format!) Hi All, I seem to be having a bit of a...
1
by: Emilio | last post by:
Hi, I have a user control with a datalist. Each datalistitem has a label which is databound, a hidden textbox which is databound, a textbox and a checkbox. like follows: <asp:datalist...
0
by: Paul Cook | last post by:
Hi I am trying to determine whether a control is being displayed at designtime or runtime but this piece of code doesn't seem to work correctly. Note that this is not a web user control (ascx)...
0
by: Dan Nash | last post by:
hi guys following on from my previous post. ive got this strange error now. my user control has the following property defined... private string theSQL; public string contactSQL { get {...
4
by: Marius Trælnes | last post by:
Hello! I am about to make a class/control that creates tabbing functionality. The result is in HTML/CSS/JavaScript output. My question is: Within the tabs I want to simply add user controls...
0
by: Richard K Bethell | last post by:
I have built a downloading engine that is designed to use the HttpWebRequest and HttpWebResponse classes to draw files in 64K chunks, rather than pull a file all at once. This is to ensure that the...
10
by: mcalex | last post by:
Hi all, I have a continuous form (not a subform) with a label, text box and two toggle buttons. When I click the toggle button for a record, that toggle button changes on ALL the records in the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.