473,520 Members | 15,501 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Addhandler with parameter ?

Is it possible to add a handler , and the function to add has a parameter ?

Or MUST the function have NO parameters ?
Thanks
Peter
Apr 21 '06 #1
3 16840
Not sure what you mean. Keep in mind that when using addhandler, you just
tell which method to call. You don't perform an actual call. This is why you
never have to specify which parameters to use in this context.

If this is not the problem, your best bet is to just show us directly what
you tried so that we can understand the problem you have...
--
Patrice

"Peter Stojkovic" <ds*@gmx.net> a écrit dans le message de news:
Os****************@TK2MSFTNGP02.phx.gbl...
Is it possible to add a handler , and the function to add has a parameter
?

Or MUST the function have NO parameters ?
Thanks
Peter

Apr 21 '06 #2
To add to what Patrice already explained, here is some sample code :
-------------------------------------
AddHandler Button1.Click, AddressOf ClickHandler
AddHandler Button2.Click, AddressOf ClickHandler

Private Sub ClickHandler (ByVal sender As System.Object, e As _
System.EventArgs)
' Your code here.
End Sub
-------------------------------------

In VB.NET, Event Handlers are Subs, not Functions, so they can't return
values. This however has no implication on whether they accept
parameters or not. In my example, the EventHandler method takes 2
parameters.

HTH,

Regards,

Cerebrus.

Apr 21 '06 #3
"Peter Stojkovic" <ds*@gmx.net> schrieb:
Is it possible to add a handler , and the function to add has a parameter
?


No problem. You do not need to list the function's signature when adding it
as a handler.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Apr 21 '06 #4

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

Similar topics

7
4005
by: UGH | last post by:
I am adding image buttons dynamically and I need to add event handler when the user clicks on one of those image buttons which will have different id for reports. Here is my code LnkImage = New ImageButton() LnkImage.ImageUrl = "~/printer.gif" LnkImage.ID = "ib" & oArray(1, id) AddHandler LnkImage.Command, AddressOf NewIbnCommandEvent()
4
2364
by: DJ | last post by:
Good morning, Still new at this so please bear with me. I am creating a table dynamically using webcontrols based on the output of a sproc from my database.The table represents test instances that the test proctor who is viewing the page has currently assigned to him or heir. Each row of the table corresponds to a single test instance and...
2
3275
by: MLS | last post by:
The documentation on dynamic handlers comes across as abiguous. Perhaps somebody could help set me straight? I have a situation where I need to dynamically create several usercontrols of the same type within a form. This usercontrol has some events associated with it. For example: Private Sub NewThingy()
7
9543
by: Richard Grant | last post by:
Hi. In c/C++ i can pass the address of a subroutine to another subroutine as an actual parameter How do I do that in VB .NET What should be the syntax for a parameter to receive the address of a subroutine Let's say theres a sub that creates buttons and I want it to receive as a parameter the address of the sub that handles the OnClick event...
2
1262
by: bdring | last post by:
I have a collection of objects. The objects gather data from separate sources. Once they get data they raise an event called GotData. I want the collection to raise an event whenever any of it's items raises an event. I have trimmed down the code to the relevent areas. I figure I have to add a handler for each item added to the collection,...
1
1324
by: myregid | last post by:
I am developing an application which used DigitalPersona gold SDK 2.4 under VB.net 2003. ---------------------------------------------------------- api in C++ ¡¾FT_startMonitoringDevice¡¿ FT_RETCODE FT_startMonitoringDevice( IN FT_HANDLE ftContext, /* device context */ IN FT_DEVICE_EVENTS_PT events); /* events handle */
3
1884
by: Vassili King | last post by:
Hi: I was wondering if anybody had a similar problem and could help me out with a situation I ran into. I would really appreciate any advice. I've created an .aspx page for my Web Application in Visual Studio 2005. I'm using .NET version 2.0. The situation narrows down to the following: -- I have a Private Sub FillTable(ByVal parameter...
2
1747
by: GAZ | last post by:
Hello all, We have a bit of a problem. We have a form where we have to add controls dynamically during runtime. That part is quite simple. Now, we have to add a ButtonClick event for each of the controls. That's where it becoms tricky. Here is the bit of code we use: ...
0
9803
by: pankajprakash | last post by:
Hi all I am using the Ajax control toolkit and want to the fill the gridview but at the time of rendering it occurs the error "Sys.ArgumentNullException: Value cannot be null. Parameter name: element". Here am posting the whole .ascx page. Will you please let me know how can i remove this error.
0
7316
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7457
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. ...
1
7195
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...
0
7585
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...
0
5761
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...
0
3292
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1672
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
1
850
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
521
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...

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.