Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / March 2006

Tip: Looking for answers? Try searching our database.

Button on form toolbar

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Leo - 10 Mar 2006 21:16 GMT
I have a form toolbar with several buttons. Ex. one button is an "Exit"
button. I can't find any code for vb.net 2003 that will allow me to only
utilize only one button within the toolbar to close the form. If anyone can
provide a good source for vb.net 2003 code examples, I would appreciate it.

Thanks,
Tim Wilson - 10 Mar 2006 23:55 GMT
All toolbar button clicks are routed through the toolbars ButtonClick event.
So you can hook an event handler into the ButtonClick event, check if the
reason this event was raised was due to a click on the Exit button
(tbtnExit, for example), and then close the form if necessary.

Private Sub ToolBar1_ButtonClick(ByVal sender As Object, ByVal e As
System.Windows.Forms.ToolBarButtonClickEventArgs) Handles
ToolBar1.ButtonClick
 If e.Button Is Me.tbtnExit Then
   Me.Close()
 End If
End Sub

Signature

Tim Wilson
.NET Compact Framework MVP

> I have a form toolbar with several buttons. Ex. one button is an "Exit"
> button. I can't find any code for vb.net 2003 that will allow me to only
> utilize only one button within the toolbar to close the form. If anyone can
> provide a good source for vb.net 2003 code examples, I would appreciate it.
>
> Thanks,
Leo - 13 Mar 2006 19:17 GMT
Thanks,

I got it to work.

My next step is trying to the toolbar to open up different forms; however, I
am wanting to open the form2 within form1. This is similar to MS Word when
creating a new document. You have the main Word window then you are able to
create new documents within the main Word window. With you new docs you are
able minimize, maximize the doc itself without closing the main Word window.

I can get form2 to open using:

Dim frmAddAsset As New frmAddAsset

       If e.Button.ImageIndex = 5 Then
           MsgBox("Thanks for using my program")
           Me.Close()

       Else
           If e.Button.ImageIndex = 0 Then
               frmAddAsset.ShowDialog(Me)
           End If

       End If

But, I want the new form2 to open within form1

Please letme know,

Leo

> All toolbar button clicks are routed through the toolbars ButtonClick event.
> So you can hook an event handler into the ButtonClick event, check if the
[quoted text clipped - 17 lines]
> >
> > Thanks,
Tim Wilson - 13 Mar 2006 20:27 GMT
I answered this question under your other post entitled "open windows form2
within windows form1".

Signature

Tim Wilson
.NET Compact Framework MVP

> Thanks,
>
[quoted text clipped - 48 lines]
> > >
> > > Thanks,

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.