473,657 Members | 2,595 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to raise a standard event on windows component

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

For example,

raiseEvent mycombobox.Sele ctionChangeComm itted

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 4533
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 SelectionChange Committed is defined in the combobox, you cannot
raise the event using RaiseEvent. Ofcourse, you can still raise the event
using mycombobox_Sele ctionChangeComm itted and pass in the parameters.

hope this helps..
Imran.
"Jeremy" <je****@ninprod ata.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
I have a combobox with a SelectionChange Committed event handler, and am
having a problem raising this event.

For example,

raiseEvent mycombobox.Sele ctionChangeComm itted

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****@ninprod ata.com> scripsit:
I have a combobox with a SelectionChange Committed event handler, and am
having a problem raising this event.

For example,

raiseEvent mycombobox.Sele ctionChangeComm itted

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 RaiseSelectionC hangeCommitted( )
MyBase.OnSelect ionChangeCommit ted(EventArgs.E mpty)
End Sub

End Class

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

Hope this helps
Jay

"Jeremy" <je****@ninprod ata.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
I have a combobox with a SelectionChange Committed event handler, and am
having a problem raising this event.

For example,

raiseEvent mycombobox.Sele ctionChangeComm itted

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
2164
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 Microsoft .NET framework. SwiftReports provides complete code integration with the Visual Studio .NET 2003 environment. Developers can use Visual Studio .NET 2003 to write code in either C# or Visual Basic .NET for report control and event handling.
3
693
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 the escape key. Public Class myStandardForm Inherits Windows.Forms.Form Private WithEvents _btnCancel As Button Private Sub _Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
1
4231
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 for the standard edition? Thank you :)
2
1910
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
2459
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 which are not behaving as I would expect. Specifically, if there is a command button external to the usercontrol which is activated by a shortcut key (eg Alt-B), the command button Click event handler code 'executes' even though the textbox set...
0
2432
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 (http://support.microsoft.com/kb/810852), but then I realized that the hotfix mentioned was in .Net v1.1, which I am using. I took the sample from that article and recreated the situation I see in my application. (Code included below.) If you run the...
2
1595
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 developed by me to a windows service developed by me. I would like to do something like, when a user changes something inmy application I would like to fire an event to my windows service and make a log. Is this possible? If I'm not clear please...
2
1938
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 doing in the following way. 1. In method GenNumbers() you remove this statement "OnEventSeven(new DivBySevenEventArgs(i));" with these
11
4019
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 the event and continue working( like fire and forget - do not wait for the event handler in client to finish.) I have gone through alot of the articles on internet and MSDN and most talk about delegates (or BackGroundWorker in 2.0 which I cannot
0
8827
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
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
8503
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
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6167
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
5632
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();...
1
2731
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
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1620
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.