473,385 Members | 1,693 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,385 software developers and data experts.

Method does not have same signature etc...

I created a button dynamically and added an event hander as follows:
AddHandler newbtnPick.Click, AddressOf newbtnPick_Click

Private Sub newbtnPick_Click()

End Sub

I get an error:
Method 'Public Sub newbtnPick_Click()' does not have the same signature as
delegate 'Delegate Sub EventHandler(sender As Object, e As
System.EventArgs)'.

So of coutse I added
ByVal sender As Object, ByVal e As EventArgs

to give me
Private Sub newbtnPick_Click(ByVal sender As Object, ByVal e As EventArgs)

End Sub

In fact even this does nto work:
Private Sub newbtnPick_Click(ByVal sender As Object)

End Sub

Why do I need the second parameter? And I am curious, how does it know I
will need the sender object?

Thanx,

--
Anil Gupte
www.keeninc.net
www.icinema.com
Oct 29 '06 #1
1 4698
>Why do I need the second parameter? And I am curious, how does it know I
>will need the sender object?
You need to make sure the method signature matches the delegate
signature. It doesn't matter if you're actually going to use the
parameters in your code or not.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Oct 29 '06 #2

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

Similar topics

1
by: Stephan Freund | last post by:
Hi, Why does not implement the class java.net.URL the method clone() (and does not implement the interface clonable)? Thank you cu Stephan
1
by: vishakha.ganjoo | last post by:
' C Sharp function - Start ' private void id_ok_Click(object sender, EventArgs e) '{ ' try ' { ' _job = new OsaScanJob((OsaSessionState)Session); ' _job.Create(); ' _job.Completed += new...
7
by: Marcos Stefanakopolus | last post by:
So this is ok: class foo { int myMethod(string, int) { ... } int myMethod(string, double) { ... } } But this is not: class foo {
19
by: Dave Raskin | last post by:
public class Base { } public class Derived : Base { } public class Service {
15
by: Patrick.O.Ige | last post by:
Hi All i'm getting error with my TreeView Menu(I want to have a button with ExpandALL and CollapseALL):- Error:- 'AddressOf' operand must be the name of a method; no parentheses are needed. I...
5
by: Simon Harris | last post by:
Hi All, I am trying to call a method in a web form, from an event fired in a user control. My user control displays a map, which has a link button to enlarge/shrink the map. When the user...
6
by: LordHog | last post by:
Hello all, I recently ran into a strange behavior which I don't understand. I have two 'Add' method which a slightly different signature which they look like public void Add( string varName,...
2
by: Richard Jebb | last post by:
We are trying to use the API of a Win32 app which presents the API as a COM interface. The sample VB code for getting and setting the values of custom data fields on an object shows a method named...
9
by: Steve Richter | last post by:
in a generic class, can I code the class so that I can call a static method of the generic class T? In the ConvertFrom method of the generic TypeConvert class I want to write, I have a call to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.