| | |
Custom User Control
Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Jan 2009
Posts: 1
Reputation:
Solved Threads: 0
Thanks in advance
i created my own toolbar from user control option
i design and add all button ADD,EDIT,DELETE,LOOKUP,CLOSE
and build this class and drag on my form
now i want to use click event of every button but there is only one click event
Public Class Form1
Private Sub Kk_toolbar1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Kk_toolbar1.Click
End Sub
and i want btndelete_click()
thanks
Khurram
i created my own toolbar from user control option
i design and add all button ADD,EDIT,DELETE,LOOKUP,CLOSE
and build this class and drag on my form
now i want to use click event of every button but there is only one click event
Public Class Form1
Private Sub Kk_toolbar1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Kk_toolbar1.Click
End Sub
and i want btndelete_click()
thanks
Khurram
Was your toolbar based on WinForms ToolBar control?
Here's a very simplified example which uses ToolBar control with two ToolStripButton controls, just to show the idea. First the user control itself
which "forwards" ToolStripButton.Click events outside of the user control.
And here's the form which uses the control
Of course, this is not the only way to do it. You may declare your event parameters differently etc.
Hope you get started with this.
Here's a very simplified example which uses ToolBar control with two ToolStripButton controls, just to show the idea. First the user control itself
VB.NET Syntax (Toggle Plain Text)
Public Class UserControl1 Public Event AddClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Public Event EditClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click RaiseEvent AddClick(sender, e) End Sub Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click RaiseEvent EditClick(sender, e) End Sub End Class
And here's the form which uses the control
VB.NET Syntax (Toggle Plain Text)
Public Class Form2 Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Private Sub UserControl1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles UserControl1.Click End Sub Private Sub UserControl1_AddClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles UserControl1.AddClick ' Handle Add-button click (= ToolStripButton1.Click) End Sub Private Sub UserControl1_EditClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles UserControl1.EditClick ' Handle Edit-button click (= ToolStripButton2.Click) End Sub End Class
Hope you get started with this.
Teme64 @ Windows Developer Blog
![]() |
Similar Threads
- Custom HttpHandler. (ASP.NET)
- Radiobutton Problem (ASP.NET)
- User Control (ASP.NET)
- New textbox in user control broke datagrid sorting (ASP.NET)
- Reality Check on picturebox control (And creating custom control) (C#)
- Subclassed Editbox Control: Do I need to create 2 subclasses for two edit controls? (C++)
- Hi! (Community Introductions)
- New Release of VB dotnet (2005) (VB.NET)
Other Threads in the VB.NET Forum
- Previous Thread: How to copy link in Outlook 2002
- Next Thread: Maximum Return Bytes of SOCKETS
| Thread Tools | Search this Thread |
"crystal .net .net2005 30minutes 2005 2008 access account add arithmetic array assignment basic box button buttons center check code component connectionstring convert cpu crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dosconsolevb.net dropdownlist editvb.net excel file-dialog firewall folder ftp generatetags hardcopy image images insert intel isnumericfuntioncall math monitor mssqlbackend mysql navigate net networking opacity output passingparameters peertopeervideostreaming picturebox1 port printpreview problem problemwithinstallation project record reports" reuse savedialog searchvb.net select serial storedprocedure string tcp temp text textbox timer toolbox trim updown user useraccounts usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web wpf





