Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 16th, 2007, 05:59 PM
Authorized User
 
Join Date: Dec 2006
Location: , , .
Posts: 70
Thanks: 0
Thanked 1 Time in 1 Post
Default attaching form to menu item

So far, I have not been able to figure out how to attach a form to the menu item I created for it.
What am I missing?

Thanks,
Karen

Reply With Quote
  #2 (permalink)  
Old January 18th, 2007, 04:48 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

A little more verbose would be nice. Windows app? Web app? What do you mean by "attach?"

Keep in mind that no one knows what you have in mind unless you [i]say[/] what you have in mind... It is really hard to do much with what you have said so far.
Reply With Quote
  #3 (permalink)  
Old January 19th, 2007, 11:56 AM
Authorized User
 
Join Date: Dec 2006
Location: , , .
Posts: 70
Thanks: 0
Thanked 1 Time in 1 Post
Default

Brian, et al,
sorry,
I am new to Windows development and am not explaining things well.

I have multiple forms and need to be able to execute them from the menus that I created.

I also want to have a generic form that can be used to for multiple different tables for editing lookup values.
Creating the menus and the forms were the easy parts, hooking it all together is what I'm not sure how to accomplish.

I know it can be done, I just don't know enough VB to do it.

Karen

Reply With Quote
  #4 (permalink)  
Old January 19th, 2007, 12:05 PM
Authorized User
 
Join Date: Nov 2006
Location: , , USA.
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ef1196
Default

First, I'm assuming that you are designing a Windows Forms application.

Let's say that you have a form called frmTools created in your project and you want to run that form from your menu. In the section of the menu code that you want to open this form you might call it as follows:

'* Create a new instance of your form
dim frmTools as new frmTools

'* Load your form as a "Non-Modal" form.
frmTools.show

'* or

'* Load your form as a "Modal" form.
frmTools.ShowDialog

Using just "Show" will display the form "Non-Modal" (you can access other parts of your application while this form is displayed).

Using "ShowDialog" will display the form "Modal" (you cannot access any other part of your application until you close this form).




Best Regards,
Earl Francis
Reply With Quote
  #5 (permalink)  
Old January 19th, 2007, 12:07 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

All of your menu items have a Click event associated with them so your method might look something like this:

VB:
Private Sub menuItem6_Click(ByVal Sender as Object, ByVal e as System.EventArgs)

End Sub

C#
private void menuItem6_Click(object sender, System.EventArgs e)
{

}

From here is where you will call your other forms so something like this:

VB:
Private Sub menuItem6_Click(ByVal Sender as Object, ByVal e as System.EventArgs)
 Dim frm as New form2()
 frm.Show()
End Sub

C#
private void menuItem6_Click(object sender, System.EventArgs e)
{
    form2 frm = new form2();
        frm.Show();
}

Obviously form2 will be the name of the Form you are wanting to work with. In so far as your question about generic forms that handle multiple different secnarios I would suggest overloading your constructors so that you can know how the generic form should be set up so:

Dim frm as New form2(<value>)
Dim frm as New form2(<value>, <value>)
Dim frm as New form2(<value>, <value>, <value>)

etc.

Hope that helps

================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
View IE Favorites in a Menu Item. jpool Visual Studio 2005 0 October 3rd, 2008 11:51 AM
right click on a menu item chuckcottle C++ Programming 3 May 14th, 2007 10:34 AM
cannot add a new item to this menu ... paulmarshall General .NET 0 April 18th, 2007 03:03 PM
how create menubar, menu, menu item in xsl vijayanmsc XSLT 1 June 5th, 2006 06:43 AM
Menu Help in statusbar at mousemove over Menu item Kaustav VB Components 1 September 14th, 2005 09:28 AM



All times are GMT -4. The time now is 09:51 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.