By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,417 Members | 904 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,417 IT Pros & Developers. It's quick & easy.

Event Handling

P: n/a
Hello!

I would like to make an event handler in a VB.NET 2005 project to check if
the battery state changes on my Windows Mobile 5 device. But I don't manage
to make this work, does anyone have an example for me?

Her is a cut from my code:

Public Shadows Event Changed As ChangeEventHandler

Private Sub PhoneInfo_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim statePowerBatteryStrength As New
SystemState(SystemProperty.PowerBatteryStrength)
AddHandler statePowerBatteryStrength.Changed, AddressOf
ChangedPowerBatteryStrength
End Sub

Private Sub ChangedPowerBatteryStrength()
ShowInfo()
End Sub
****************
The statement ....,AddressOf ChangedPowerBatteryStrength gives me an error
that says:

Method 'Private Sub ChangedPowerBatteryStrength()' does not have the same
signature as delegate 'Delegate Sub ChangeEventHandler(sender As Object,
args As Microsoft.WindowsMobile.Status.ChangeEventArgs)'.
Regards

Morten Fagermoen
Mar 24 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Make shure that the ChangedPowerBatteryStrength() accepts the same
types of parameters as the ChangeEventHandler delegate.

In your case you have to add: sender As Object,
args As Microsoft.WindowsMobile.Status.ChangeEventArgs

Mar 24 '06 #2

P: n/a
Thank you very much, Jan!!

This made it work and I learned something today to!!
Regards

Morten Fagermoen
Mar 25 '06 #3

P: n/a
You are welcome ;)

Mar 25 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.