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

Why Control_Change() event is fired before Form_Load()?

neo008
85
Hi all,

Why Control_Change() event is fired before Form_Load()?


NE☼
Jun 24 '07 #1
9 1097
Killer42
8,435 Expert 8TB
Why Control_Change() event is fired before Form_Load()?
I don't think it is.

In any case, which version of VB are you referring to?
Jun 24 '07 #2
neo008
85
Ofcourse it should not, as I believe too. I'm using VB6.

I saw it by using "step into" (F8) from Debug menu.


I think my Console is to be repaired.


NE☼
Jun 24 '07 #3
Killer42
8,435 Expert 8TB
What sort of control is it? Perhaps it is firing an event when it shouldn't (assuming that's possible).
Jun 24 '07 #4
pureenhanoi
175 100+
Hi all,

Why Control_Change() event is fired before Form_Load()?


NE☼
this appears only when u try changing some properties of form's controls before using .Show method.
Example:
Form1 Code
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. 'yours calculate here
  3. result = calculate(smthing)
  4. Form2.Text1.Text = result
  5. Form2.Show
  6. End Sub
  7.  
Here, i calculated some value in form1 and pass it through form2. If u do so, either, u will sometime see Form2 load twice. One before Text1_Change() and one after.
Jun 25 '07 #5
Killer42
8,435 Expert 8TB
...Here, i calculated some value in form1 and pass it through form2. If u do so, either, u will sometime see Form2 load twice. One before Text1_Change() and one after.
That's interesting. Even if you do this, it should only load the form once, unless you unload it in between. As soon as you access the contents of the form (Form2.Text1.Text in this case) the form must first be loaded. It should not then be loaded again when you show it, merely made visible.

In theory, that is.
Jun 25 '07 #6
Killer42
8,435 Expert 8TB
A quick test verifies this. As soon as you access a property of the control (text property of a textbox in my test) the form is loaded, then the control's change event fires. Then when you Show the form, neither event fires. As expected.
Jun 25 '07 #7
neo008
85
Yeah, quick test verifies as expected. This is why i'm surprised why it's showing behavior which is unexpected.

Surely there is a reason behind it means I'm using/doing something which made textbox_change event to be fired before form load.

I am doing simple tax, amount calculations in form and no form properties are being accessed (atleast in change events)

I will surely find and tell you the reason soon. Any comment/Idea is welcome.

NE☼
Jun 25 '07 #8
hariharanmca
1,977 1GB
Hi all,

Why Control_Change() event is fired before Form_Load()?


NE☼

i think this may happen

Expand|Select|Wrap|Line Numbers
  1. Private sub control_Change()
  2.     Control.text = ”Changed”
  3. End sub
  4.  
  5. Private sub Form_Load()
  6.     Control.text = ”Do not Chang”
  7. End sub
Then output will be :

Control.text = ”Changed”
Jun 25 '07 #9
Killer42
8,435 Expert 8TB
i think this may happen...
Possibly, but I think neo008 indicated that stepping through the code showed the sequence in which they fired.
Jun 25 '07 #10

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

Similar topics

2
by: theintrepidfox | last post by:
Dear Group Just wondered whether you have any advice on the following? I have a form with a TabControl and when the form loads, the SelectedIndexChanged event is fired. Is there any chance to...
0
by: Michael Cleroux | last post by:
Hi there, I read this in the Access 2002 help file: 'The class that raises an event is the event source, and the classes that implement the event are the sinks. An event source can have...
3
by: Rich | last post by:
Hi everyone, I have run into a quandry here. Here is a simplified scenario that mirrors my real problem. I have a page that has 2 buttons: On page load, the page runs some complex...
4
by: C M Shaw | last post by:
I have a form which I want to show modally; it's a fairly old form that's been ported up several versions of VB, and I'd like to keep its rewriting to a minimum. Basically, it is used in this...
41
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based...
8
by: garyusenet | last post by:
I was originally taught to double click the form, to get to the load event handler and in there put anything I want to happen when my form is opened. However, today whilst reorganising some code...
2
by: alexia.bee | last post by:
Hi All, I have window based app which has two classes. Class A and Clas B Call B Inherits from Class A. Class A has events. How do I cause Class B not to use Class A events. For example:...
3
by: Hamed | last post by:
Hello I have a Data Entry Form having some controls including a TextBox. When the user types an entry, I query a table and if it was entered before, I ask the user (using ShowModal method of a...
2
by: =?Utf-8?B?VG9u?= | last post by:
Hello, I want to understand teh benefits of ajax technology. Does anyone has a good website where AJAX EXTENSIONS is worked out so I really understand it. There a 2 main questions: 1) How about...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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
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...
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,...
0
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...

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.