473,405 Members | 2,338 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 does the Winform's InitializeComponent sub call a private Sub

Hello:

I have a winform that has a private subroutine defined as:

Private Sub ApplyFilter()

This sub refers to objects that get instantiated in the
winform's new method.

However, when I run the application, the New Method has a
InitializeComponent() method that steps into the private
subroutine I have, creating an error condition.

Is this the normal course of events? If not, what am I
doing wrong?

Thanks.

Venkat

Nov 20 '05 #1
3 5230
"Venkat Venkataramanan" <th****@hotmail.com> schrieb
I have a winform that has a private subroutine defined as:

Private Sub ApplyFilter()

This sub refers to objects that get instantiated in the
winform's new method.

However, when I run the application, the New Method has a
InitializeComponent() method that steps into the private
subroutine I have, creating an error condition.

Is this the normal course of events? If not, what am I
doing wrong?


Are you sure that InitializeComponent calls your sub? You can set a
breakpoint in your sub and have a look at the callstack to find out what
causes the call.
--
Armin

Nov 20 '05 #2
Hello,

"Venkat Venkataramanan" <th****@hotmail.com> schrieb:
I have a winform that has a private subroutine defined as:

Private Sub ApplyFilter()

This sub refers to objects that get instantiated in the
winform's new method.

However, when I run the application, the New Method has a
InitializeComponent() method that steps into the private
subroutine I have, creating an error condition.


Where do you call your method 'ApplyFilter'?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #3
Armin:

I found out where I am shooting myself in my foot!

The subroutine also gets called in the CheckStateChanged
event on a check box. Of course this gets triggered by
the Initialize Component subroutine.

I changed it so it gets called on the clicked event
instead.

Thanks for your insight.

Venkat
-----Original Message-----
"Venkat Venkataramanan" <th****@hotmail.com> schrieb
I have a winform that has a private subroutine defined as:
Private Sub ApplyFilter()

This sub refers to objects that get instantiated in the
winform's new method.

However, when I run the application, the New Method has a InitializeComponent() method that steps into the private subroutine I have, creating an error condition.

Is this the normal course of events? If not, what am I
doing wrong?
Are you sure that InitializeComponent calls your sub?

You can set abreakpoint in your sub and have a look at the callstack to find out whatcauses the call.
--
Armin

.

Nov 20 '05 #4

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

Similar topics

0
by: Dave | last post by:
Hi all, To repro the problem I am having: 1. Create a class that derives from System.Windows.Forms.Form 2. Add some controls such as buttons and labels (wherever you want). The default values...
2
by: SammyBar | last post by:
Hi, I'm trying to bind a custom collection class to a data grid, following the guidelines from the article http://msdn.microsoft.com/msdnmag/issues/05/08/CollectionsandDataBinding/default.aspx....
3
by: David N | last post by:
Hi All, I just wonder if in C#, I can develop a user defined control that can call its parent function which is not yet developed. For example, how do I make my user control call a...
4
by: Alex Bibiano | last post by:
I have a typed dataset in my WinForm and a textbox with databinding to the dataset (all without code). Now, in a button event, I assign a new dataset (retrieved from a function) to the dataset a...
2
by: Besta | last post by:
Hello all, I am having trouble creating a windows service with a timer. Everything seems to go ok but the elapsed event does not fire.Can anyone shed any light on this, may be something simple as...
6
by: Mark | last post by:
I have been working for quite some time on this issue which in theory should be quite simple. The problem is that the Cancel and Save events are not fired when their respective buttons are...
2
by: Benedict Teoh | last post by:
I created a dropdownlist containing day, month and year field and expose a property to assign a date. When I call from a aspx page and assign the value, the new date is not displayed until a submit...
3
by: Ken | last post by:
How can I have my WinForm return something to the caller so it knows which button is clicked? The following is calling a system message box, just want to do the samething with my own winform....
0
by: dadizhu | last post by:
Hi, everyone. I ran into an UI freeze issue with threading and simplied the problem down to the following sample code. The logic is as follows: 1. The main UI thread creates a non-UI STA...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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.