473,320 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

TrackBar 'Validating' Event Hander doesn't match Delegate?

I am trying to add a 'Validating' event handler to a TrackBar.

Code:
...
this->tbKeyboards->Validating += new System::EventHandler(this,
tbKeyboards_Validating);
...
System::Void tbKeyboards_Validating(Object* sender,
System::ComponentModel::CancelEventArgs* e)
...

Compiling this code results in the following error: "void
kbKeyboards_Validating(System::Object __gc
*,System::ComponentModel::CancelEventArgs __gc *)' : the specified
function does not match the delegate type 'void (System::Object __gc
*,System::EventArgs __gc *)"

So I change the 'System::ComponentModel::CancelEventArgs' to
'System::EventArgs' in order to fix it. (It doesn't seem to make sense
because what is the use of a Validating event if there is no
cancelEventArgs?) Anyway, changing it gives me this error:
"'System::Windows::Forms::Control::add_Validat ing' : cannot convert
parameter 1 from 'System::EventHandler __gc *' to
'System::ComponentModel::CancelEventHandler __gc *'"

So what's wrong?

Thanks.
Nov 17 '05 #1
1 1425
It would probably help if I posted the function code (oops):

// First Way
private: System::Void tbKeyboards_Validating(Object* sender,
System::ComponentModel::CancelEventArgs* e) { }

// Second Way
private: System::Void tbKeyboards_Validating(Object* sender,
System::EventArgs* e) { }
Nov 17 '05 #2

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

Similar topics

2
by: Frank Rizzo | last post by:
Hello, I have a library written in vb.net that I want to use in my c# project. The library has an event written as: Public Event KeyPressed(ByVal Character As String, ByVal KeyCode As Integer) ...
6
by: Dan Bass | last post by:
I'm writing a scanner application (C# / .Net CF) where I have one scanner object (singleton) that hooks into the scan engine drivers. There is scanner event for a successful scan, that passes...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
13
by: Charles Law | last post by:
Mr "yEaH rIgHt" posted the following link about a week ago in answer to my question about removing event handlers. > http://www.vbinfozine.com/t_bindevt.shtml Following on from that post, the...
41
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based...
7
by: Michael D. Ober | last post by:
Is there anyway to raise an event from a class and require that any program using that class (not just inheritance) have an event handler for specific events in the class? In my case, some events...
4
by: _DD | last post by:
TrackBar DoubleClick event is not accessible via the Control Properties event pane. So I tried adding the handler directly: this.ColTrackBar.DoubleClick += new...
2
by: John | last post by:
Ok, something that I thought would be easy is giving me fits. Using .NET 2.0 and C# I've added a Trackbar to a form. Set some values: trackVolume.Maximum = 100; trackVolume.Minimum = 0;...
3
by: Ryan McFall | last post by:
Hi: I am trying to write a short program that demonstrates switching between two different event handlers when a mouse click occurs. Here's the relevant code: public delegate void...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.