Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > add eventhandler at runtime in VB

Reply
Thread Tools

add eventhandler at runtime in VB

 
 
SteveR
Guest
Posts: n/a
 
      02-07-2005
I want to add an imagebutton control into a datagrid at runtime and use the
click event to navigate to another page. I can do this in C#
imagebutton.click += new eventhandler... but how do I do this in VB?
--
Steve
 
Reply With Quote
 
 
 
 
Alvin Bruney [MVP]
Guest
Posts: n/a
 
      02-08-2005
C#
this.openFile.FileOk += New
System.ComponentModel.CancelEventHandler(this.open File_FileOk);

VB.NET
Me.openFile.FileOk += New
System.ComponentModel.CancelEventHandler(Me.openFi le_FileOk)

I used Kamal's site for the conversion
http://www.kamalpatel.net/ConvertCSharp2VB.aspx

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://tinyurl.com/27cok
----------------------------------------------------------


"SteveR" <> wrote in message
news:0D47929E-9E31-4A32-8FF0-...
>I want to add an imagebutton control into a datagrid at runtime and use the
> click event to navigate to another page. I can do this in C#
> imagebutton.click += new eventhandler... but how do I do this in VB?
> --
> Steve



 
Reply With Quote
 
 
 
 
SteveR
Guest
Posts: n/a
 
      02-08-2005
Where do I have to add this? I want to add it in the ItemDataBound event of a
datagrid but the intellisense doesn't list any of the events to add an event
handler to. In fact I can't find anywhere where intellisense gives access to
any of the events in the way you describe. (C# does it but this project is
already well underway using VB so changing the language now isn't an option)
Steve


"Alvin Bruney [MVP]" wrote:

> C#
> this.openFile.FileOk += New
> System.ComponentModel.CancelEventHandler(this.open File_FileOk);
>
> VB.NET
> Me.openFile.FileOk += New
> System.ComponentModel.CancelEventHandler(Me.openFi le_FileOk)
>
> I used Kamal's site for the conversion
> http://www.kamalpatel.net/ConvertCSharp2VB.aspx
>
> --
> Regards,
> Alvin Bruney [MVP ASP.NET]
>
> [Shameless Author plug]
> The Microsoft Office Web Components Black Book with .NET
> Now Available @ http://tinyurl.com/27cok
> ----------------------------------------------------------
>
>
> "SteveR" <> wrote in message
> news:0D47929E-9E31-4A32-8FF0-...
> >I want to add an imagebutton control into a datagrid at runtime and use the
> > click event to navigate to another page. I can do this in C#
> > imagebutton.click += new eventhandler... but how do I do this in VB?
> > --
> > Steve

>
>
>

 
Reply With Quote
 
SteveR
Guest
Posts: n/a
 
      02-15-2005
I found out how to do it, you have to add:

AddHandler tmpButton.Click, AddressOf myClick

the definition of myClick is:

Private Sub myClick(ByVal sender As System.Object, ByVal e As
System.EventArgs)

"SteveR" wrote:

> Where do I have to add this? I want to add it in the ItemDataBound event of a
> datagrid but the intellisense doesn't list any of the events to add an event
> handler to. In fact I can't find anywhere where intellisense gives access to
> any of the events in the way you describe. (C# does it but this project is
> already well underway using VB so changing the language now isn't an option)
> Steve
>
>
> "Alvin Bruney [MVP]" wrote:
>
> > C#
> > this.openFile.FileOk += New
> > System.ComponentModel.CancelEventHandler(this.open File_FileOk);
> >
> > VB.NET
> > Me.openFile.FileOk += New
> > System.ComponentModel.CancelEventHandler(Me.openFi le_FileOk)
> >
> > I used Kamal's site for the conversion
> > http://www.kamalpatel.net/ConvertCSharp2VB.aspx
> >
> > --
> > Regards,
> > Alvin Bruney [MVP ASP.NET]
> >
> > [Shameless Author plug]
> > The Microsoft Office Web Components Black Book with .NET
> > Now Available @ http://tinyurl.com/27cok
> > ----------------------------------------------------------
> >
> >
> > "SteveR" <> wrote in message
> > news:0D47929E-9E31-4A32-8FF0-...
> > >I want to add an imagebutton control into a datagrid at runtime and use the
> > > click event to navigate to another page. I can do this in C#
> > > imagebutton.click += new eventhandler... but how do I do this in VB?
> > > --
> > > Steve

> >
> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie question - Runtime Button and EventHandler Mr Not So Know It All ASP .Net 9 03-28-2007 12:51 AM
How to add items to a dropdownlist control within a Javascript eventhandler? Oscar ASP .Net 6 07-31-2005 09:17 PM
Re: Need to add EventHandler to control created at run time Karl ASP .Net 0 08-24-2004 10:43 PM
Adding Eventhandler for a Button in datagrid... in runtime? Lars Netzel ASP .Net 0 07-09-2004 10:09 AM
Add an eventhandler on a button_click =?Utf-8?B?QWxlc3NhbmRybyBSb3NzaQ==?= ASP .Net 1 02-17-2004 07:53 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57