473,465 Members | 1,399 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to raise a standard event on windows component

I have a combobox with a SelectionChangeCommitted event handler, and am
having a problem raising this event.

For example,

raiseEvent mycombobox.SelectionChangeCommitted

gives me an error about not being ended properly. But it won't accept
parameters either. What's the trick here?

Jeremy
Nov 21 '05 #1
4 4507
As per the msdn document:
http://msdn.microsoft.com/library/de...raiseevent.asp

"You cannot use RaiseEvent to raise events that are not explicitly declared
in the module."

Since the SelectionChangeCommitted is defined in the combobox, you cannot
raise the event using RaiseEvent. Ofcourse, you can still raise the event
using mycombobox_SelectionChangeCommitted and pass in the parameters.

hope this helps..
Imran.
"Jeremy" <je****@ninprodata.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I have a combobox with a SelectionChangeCommitted event handler, and am
having a problem raising this event.

For example,

raiseEvent mycombobox.SelectionChangeCommitted

gives me an error about not being ended properly. But it won't accept
parameters either. What's the trick here?

Jeremy

Nov 21 '05 #2
* "Jeremy" <je****@ninprodata.com> scripsit:
I have a combobox with a SelectionChangeCommitted event handler, and am
having a problem raising this event.

For example,

raiseEvent mycombobox.SelectionChangeCommitted

gives me an error about not being ended properly. But it won't accept
parameters either. What's the trick here?


Where do you use this code? Notice that 'RaiseEvent' will only work
inside the class that defines the event. To raise the event from
outside the class, provide a public method that expects the event
arguments in a parameter and raises the event using 'RaiseEvent'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #3
Jeremy,

Why not just call the method?

Cor
Nov 21 '05 #4
Jeremy,
As the other's suggest only the class itself can raise its events. To allow
derived classes to raise base class events there is a standard Event pattern
you should consider implementing in your classes.

http://msdn.microsoft.com/library/de...Guidelines.asp

Knowing this pattern will allow you to create a custom ComboBox class that
will allow you to raise the event you want.

Something like:

Public Class ComboBoxEx
Inherits ComboBox

Public Sub RaiseSelectionChangeCommitted()
MyBase.OnSelectionChangeCommitted(EventArgs.Empty)
End Sub

End Class

Then instead of using ComboBox, you can use ComboBoxEx on your forms, then
every place you want to raise the SelectionChangeCommitted event, you simply
call the RaiseSelectionChangeCommitted method.

Hope this helps
Jay

"Jeremy" <je****@ninprodata.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I have a combobox with a SelectionChangeCommitted event handler, and am
having a problem raising this event.

For example,

raiseEvent mycombobox.SelectionChangeCommitted

gives me an error about not being ended properly. But it won't accept
parameters either. What's the trick here?

Jeremy

Nov 21 '05 #5

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

Similar topics

1
by: Corrie Meyer | last post by:
Announcement: SwiftReports standard edition 1.0 for Visual Studio ..NET 2003 released by UniSwift. We are pleased to announce the first release of a fully-managed reporting tool for the...
3
by: Cary Linkfield | last post by:
I have a standard form I use. It inherits from Windows.Forms.Form. I usually add a Cancel button the form in the designer. I want to raise the Cancel button's Click event when the user presses...
1
by: Thomas Holmgren | last post by:
Hi all I've tried to get my hands on the End User License Agreement for MS Visual C# .NET 2003 STANDARD edition, sofar without luck. Does anybody know where I can find the license agreement...
2
by: Andrew | last post by:
Hi, friends, I need to raise certain events in my VC# windows control library. Any reference paper or sample source code for help? Thanks a lot...
0
by: Matthew | last post by:
All, I have searched google and the newsgroups but can't find anything the same as what I am experiencing (though I may have missed something). I have controls (textboxes) within UserControls...
0
by: Gary Shell | last post by:
I am experiencing some strange behavior between a UserControl's validating event and a treeview control. Initially, I thought it was related to an issue in the Knowledgebase article 810852...
2
by: Filipe Marcelino | last post by:
Hi, I'm an experienced vb .net developer in windows forma. Now I'm trying to develop a windows service and I would like to know if it's possible to raise an event from a windows application...
2
by: tony | last post by:
Hello !! I have a question about event. This small program below is taken from the internet and I wonder if there are any advantage to use this Onxxx in this case it's OnEventSeven instead of...
11
by: nadeem_far | last post by:
Hello, I am working on a c# project using framework 1.1. Since its a console application,no windows forms are being used. I am trying to implement event driven classes that just want to raise...
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
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,...
1
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,...
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.