| | |
Custom User Control
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
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 2008 access add application arithmetic array assignment basic binary box button buttons center click code combo combobox component connectionstring convert cpu data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dosconsolevb.net editvb.net employees excel exists firewall folder image images isnumericfuntioncall login math memory mobile module ms msaccess mssqlbackend mysql navigate net opacity pan peertopeervideostreaming picturebox picturebox1 port print printpreview problemwithinstallation project record regex reports" reuse right-to-left save savedialog search serial sorting sqldatbase storedprocedure string temp textbox timer txttoxmlconverter updown useraccounts usercontol usercontrol vb vb.net vb.netcode vb.nettoolboxvisualbasic2008sidebar vbnet view vista visual visualbasic visualbasic.net visualstudio web wpf xml





