473,698 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Strange RaiseEvent Problem

Hi all,

I'm having a problem when trying to raise an event in my custom control when
a toolstripbutton enable state changes. The problem is that although the
code to raise the event executes, my handler never see it.

This executes when the button enable state changes:-

Private Sub OnPrintToolStri pButton_Enabled Changed(ByVal sender As Object,
ByVal e As System.EventArg s)Handles PrintToolStripB utton.EnabledCh anged
RaiseEvent PrintToolStripB utton_EnabledCh anged(sender, e)
End Sub ' This doesn't raise an event

When I step through the code, the raiseevent line executes but the debugger
doesn't jump to my handler.

If however, I raise the exact same event, but from a button click event,
then it works as expected and the event handler is run.

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
RaiseEvent PrintToolStripB utton_EnabledCh anged(sender, e)
End Sub ' This raises the event ok

This is my event handler code:
Private Sub MyControl_Print ToolStripButton _EnabledChanged (ByVal sender As
Object, ByVal e As System.EventArg s) Handles
MyControl.Print ToolStripButton _EnabledChanged
Me.Menu_Print.E nabled = MyControl.Print ToolStripButton .Enabled
End Sub

Has anyone encountered anything similar, or is able to point out my obvious
mistake?

Thanks for your time and kind regards,

Martin.
Dec 21 '06 #1
3 1759
Never mind, I have figured it out at last. Phew!
"Martin" <@ntlworld.comw rote in message
news:Av******** **********@news fe6-gui.ntli.net...
Hi all,

I'm having a problem when trying to raise an event in my custom control
when a toolstripbutton enable state changes. The problem is that although
the code to raise the event executes, my handler never see it.

This executes when the button enable state changes:-

Private Sub OnPrintToolStri pButton_Enabled Changed(ByVal sender As Object,
ByVal e As System.EventArg s)Handles PrintToolStripB utton.EnabledCh anged
RaiseEvent PrintToolStripB utton_EnabledCh anged(sender, e)
End Sub ' This doesn't raise an event

When I step through the code, the raiseevent line executes but the
debugger doesn't jump to my handler.

If however, I raise the exact same event, but from a button click event,
then it works as expected and the event handler is run.

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
RaiseEvent PrintToolStripB utton_EnabledCh anged(sender, e)
End Sub ' This raises the event ok

This is my event handler code:
Private Sub MyControl_Print ToolStripButton _EnabledChanged (ByVal sender As
Object, ByVal e As System.EventArg s) Handles
MyControl.Print ToolStripButton _EnabledChanged
Me.Menu_Print.E nabled = MyControl.Print ToolStripButton .Enabled
End Sub

Has anyone encountered anything similar, or is able to point out my
obvious mistake?

Thanks for your time and kind regards,

Martin.

Dec 22 '06 #2
Never mind, I have figured it out at last. Phew!

Care to tell us? It's considered common courtesy to share you're
solution, in case someone else has a similar problem.

Thanks,

Seth Rowe
Martin wrote:
Never mind, I have figured it out at last. Phew!
"Martin" <@ntlworld.comw rote in message
news:Av******** **********@news fe6-gui.ntli.net...
Hi all,

I'm having a problem when trying to raise an event in my custom control
when a toolstripbutton enable state changes. The problem is that although
the code to raise the event executes, my handler never see it.

This executes when the button enable state changes:-

Private Sub OnPrintToolStri pButton_Enabled Changed(ByVal sender As Object,
ByVal e As System.EventArg s)Handles PrintToolStripB utton.EnabledCh anged
RaiseEvent PrintToolStripB utton_EnabledCh anged(sender, e)
End Sub ' This doesn't raise an event

When I step through the code, the raiseevent line executes but the
debugger doesn't jump to my handler.

If however, I raise the exact same event, but from a button click event,
then it works as expected and the event handler is run.

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
RaiseEvent PrintToolStripB utton_EnabledCh anged(sender, e)
End Sub ' This raises the event ok

This is my event handler code:
Private Sub MyControl_Print ToolStripButton _EnabledChanged (ByVal sender As
Object, ByVal e As System.EventArg s) Handles
MyControl.Print ToolStripButton _EnabledChanged
Me.Menu_Print.E nabled = MyControl.Print ToolStripButton .Enabled
End Sub

Has anyone encountered anything similar, or is able to point out my
obvious mistake?

Thanks for your time and kind regards,

Martin.
Dec 22 '06 #3
Well, it turned out to be a mistake in my code, so the solution was 'not to
make mistakes'. A little embarrassing really! lol

Regards,

Martin.

"rowe_newsgroup s" <ro********@yah oo.comwrote in message
news:11******** *************@4 2g2000cwt.googl egroups.com...
>Never mind, I have figured it out at last. Phew!

Care to tell us? It's considered common courtesy to share you're
solution, in case someone else has a similar problem.

Thanks,

Seth Rowe
Martin wrote:
>Never mind, I have figured it out at last. Phew!
"Martin" <@ntlworld.comw rote in message
news:Av******* ***********@new sfe6-gui.ntli.net...
Hi all,

I'm having a problem when trying to raise an event in my custom control
when a toolstripbutton enable state changes. The problem is that
although
the code to raise the event executes, my handler never see it.

This executes when the button enable state changes:-

Private Sub OnPrintToolStri pButton_Enabled Changed(ByVal sender As
Object,
ByVal e As System.EventArg s)Handles PrintToolStripB utton.EnabledCh anged
RaiseEvent PrintToolStripB utton_EnabledCh anged(sender, e)
End Sub ' This doesn't raise an event

When I step through the code, the raiseevent line executes but the
debugger doesn't jump to my handler.

If however, I raise the exact same event, but from a button click
event,
then it works as expected and the event handler is run.

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
RaiseEvent PrintToolStripB utton_EnabledCh anged(sender, e)
End Sub ' This raises the event ok

This is my event handler code:
Private Sub MyControl_Print ToolStripButton _EnabledChanged (ByVal sender
As
Object, ByVal e As System.EventArg s) Handles
MyControl.Print ToolStripButton _EnabledChanged
Me.Menu_Print.E nabled = MyControl.Print ToolStripButton .Enabled
End Sub

Has anyone encountered anything similar, or is able to point out my
obvious mistake?

Thanks for your time and kind regards,

Martin.

Dec 22 '06 #4

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

Similar topics

4
6096
by: Oz | last post by:
This is long. Bear with me, as I will really go through all the convoluted stuff that shows there is a problem with streams (at least when used to redirect stdout). The basic idea is that my application (VB.NET) will start a process, redirect its stdout and capture that process' output, displaying it in a window. I've written a component for this, and a test application for the component. It allows me to specify a command to execute,...
1
1634
by: Guille | last post by:
Hi all! I'm having some weird behaviour in a .NET application i'm developing. I'll try to explain: I've created a Class that wraps an asynchronous socket. When connect callback is called, i raise a class event : ' Create socket sock = New Socket(AddressFamily.InterNetwork, _
2
6799
by: Carl tam | last post by:
Hi everyone, I got a quite interesting problem myself and got stuck. I have an aspx page with a windows user control with it. in the Windows Control. I have a RaiseEvent statement, say OnClearAlarm, and tell the computer to RaiseEvent when I click on the Panel. in the webpage, I first load the user control, and then have a javascript function to handle the event:
2
1434
by: Lim | last post by:
I've developed a program that raise an event. This program works fine on a Windows 2000 Professional PC. However when I try to run the program on a Windos XP Professional PC, the program will not execute the raiseevent function. How can I resolve the problem?
2
2003
by: dmoonme | last post by:
I'm trying to rename some files in a directory. Pretty basic stuff - renaming the files works fine but the problem I have is updated the text in textbox. All I want to do is appendtext to a textbox. The problem is that duplicate text occurs. Hopefully my code will explain better what I'm trying to do and what i'm doing wrong :) Thanks for your help! Public Class Form1 Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e...
7
6535
by: Onokiyo | last post by:
Hello, I have the code below and somehow the message from RaiseEvent doesn't pop up at all. Can someone help me please? '------CODE '------/form1.vb/VB2005/Framework20--------- Imports System
1
2047
by: Terry Olsen | last post by:
I have a program with a couple of long running processes that i'm calling on a separate thread. When the process is completed, I want to raise an event to tell the main thread that it's done. I set it up this way... Public Class frmLongRunningProcess Public Enum Proc ParseZipFiles = 0
2
1379
by: ffa | last post by:
I have a number of classes that declare a public Event called RefreshData: Public Class Client Implements INotifyPropertyChanged Implements IDisposable Implements IDataErrorInfo Public Event PropertyChanged(ByVal sender As Object, ByVal e As
10
6743
by: hzgt9b | last post by:
Using VS2005, VB.NET, I am developing a windows app. The application opens a couple of forms. While the forms are open I want to raise some events, such as logging errors - but I call RaiseEvent, nothing happens. Below are some code snippets that show what I am doing. Can someone straighten me out... I feel like this must be something real simple... '------------------------------------------------------------------------------ Public...
0
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8899
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
8871
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...
0
7738
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
6528
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
5861
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
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2335
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
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.