473,666 Members | 2,181 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why does the Winform's InitializeCompo nent 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
InitializeCompo nent() 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 5252
"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
InitializeCompo nent() 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 InitializeCompo nent 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
InitializeCompo nent() 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 CheckStateChang ed
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 InitializeCompo nent() 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 InitializeCompo nent 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
1228
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 must be set appropriately. 3. Add some public properties to the form that directly adjust the exposed private Control properties: public class BaseForm : Form {
2
2742
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. The problem is the article is in VisualBasic. I already get the collection to be recognized as a Data Source by the IDE. It populated the DataGrid correctly from the fields on the items object of the collection, but I can't get the DataGrid to...
3
11873
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 to-be-developed-function cmdOkay_Click() function as described below. 1. Create an user control that contains an OK button as below Public Class MyButton:System.Windows.Form.UserControl
4
15969
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 had in the form, but the textbos isn't refreshed. Exemple code from my button click event: dataset1 = helper.GetUser(6);
2
5154
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 I am new to this. Full code below : using System; using System.Collections; using System.ComponentModel;
6
4474
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 clicked. I have read several posts which say to put your column generating section in the Page_Init section and it will solve the problem....however, it hasn't solved mine. Can somebody please take a look at this and provide any insight if possible?
2
3111
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 is performed. How do I force the usercontrol to display the newly assigned date? I don't have this problem if I place the two dropdownlist and the year field directly on the aspx page.
3
2827
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. Thanks. If MsgBox("Data added.", MsgBoxStyle.OKCancel, "Message") = MsgBoxResult.OK Then ' do something End If
0
2007
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 thread(m_MainThread). 2. Then the non-UI thread runs and creates derived winform and holds a reference to the winform. NOTE: I don't call Application.Run() because I don't need a message pump on this "hidden form" in my application. I rely on the...
0
8454
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8785
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
8560
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
7389
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6200
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
5671
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4200
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
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
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

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.