PC Review Forums Newsgroups Microsoft DotNet Microsoft VB .NET Visual Studio 2003 Menu on form.vb

Reply

Visual Studio 2003 Menu on form.vb

 
Thread Tools Rate Thread
Old 14-03-2006, 06:21 PM   #1
Phill Emery
Guest
 
Posts: n/a
Default Visual Studio 2003 Menu on form.vb


hi can anyone please help me?

Im new to visual studio 2003 and im trying to create a program in visual
basic.
The problem is i have put a menu bar onto the first form, and have created
some other forms but cannot find any options to point from the menu to any
of the other forms i have created.

can anyone help me, as i would be very greatful

Thanks Phill


  Reply With Quote
Old 14-03-2006, 06:28 PM   #2
Armin Zingler
Guest
 
Posts: n/a
Default Re: Visual Studio 2003 Menu on form.vb

"Phill Emery" <phill81_emery@hotmail.com> schrieb
> hi can anyone please help me?
>
> Im new to visual studio 2003 and im trying to create a program in
> visual basic.
> The problem is i have put a menu bar onto the first form, and have
> created some other forms but cannot find any options to point from
> the menu to any of the other forms i have created.
>
> can anyone help me, as i would be very greatful


Handle the menu's click event. In the event handler, open one of the Forms.

See also:

http://msdn.microsoft.com/library/e...entHandling.asp

http://msdn.microsoft.com/library/e...odelessForm.asp

http://msdn.microsoft.com/library/e...Inheritance.asp



Armin

  Reply With Quote
Old 14-03-2006, 06:37 PM   #3
Chris
Guest
 
Posts: n/a
Default Re: Visual Studio 2003 Menu on form.vb

Phill Emery wrote:
> hi can anyone please help me?
>
> Im new to visual studio 2003 and im trying to create a program in visual
> basic.
> The problem is i have put a menu bar onto the first form, and have created
> some other forms but cannot find any options to point from the menu to any
> of the other forms i have created.
>
> can anyone help me, as i would be very greatful
>
> Thanks Phill
>
>


What do you mean, "point from the menu to any other forms"

Are you asking how you open a new form from a menu item?

The menu item calls a function. In that function you can do whatever
you want, including opening a new form.

Dim NewForm as new FormType
NewForm.ShowDialog


When I create my menu I do something like (this if for a context menu)

////
RightClick.MenuItems.Add("&Edit", New EventHandler(AddressOf
EditRecord))
RightClick.MenuItems.Add("&New", New EventHandler(AddressOf
NewRecord))
RightClick.MenuItems.Add("&Delete", New EventHandler(AddressOf
DeleteRecord))
RightClick.MenuItems.Add("Re&conciled", New
EventHandler(AddressOf MarkasReconciled))
RightClick.MenuItems.Add("&Refresh", New EventHandler(AddressOf
RefreshData))
RightClick.MenuItems.Add("&Highlight", New
EventHandler(AddressOf Highlight))
\\\\

You see that I add an EventHandler that points to a function

Chris
  Reply With Quote
Old 15-03-2006, 09:11 AM   #4
Phill Emery
Guest
 
Posts: n/a
Default Re: Visual Studio 2003 Menu on form.vb

yes i want to know how to open a new form from a menu item.

i have got this so far

Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem6.Click

Dim FilmsToGet As New Form

FilmsToGet.ShowDialog()

and want to link menu item 6 to a form called FilmsToGet.vb, but this isnt
working

and i get this error at the top of the page.

D:\My Documents\Visual Studio Projects\Film Database\Form1.vb(1): 'Class'
statement must end with a matching 'End Class'.


can you point me in the right direction please.

Phill


"Chris" <no@spam.com> wrote in message
news:OmjJXZ5RGHA.5780@TK2MSFTNGP10.phx.gbl...
> Phill Emery wrote:
> > hi can anyone please help me?
> >
> > Im new to visual studio 2003 and im trying to create a program in visual
> > basic.
> > The problem is i have put a menu bar onto the first form, and have

created
> > some other forms but cannot find any options to point from the menu to

any
> > of the other forms i have created.
> >
> > can anyone help me, as i would be very greatful
> >
> > Thanks Phill
> >
> >

>
> What do you mean, "point from the menu to any other forms"
>
> Are you asking how you open a new form from a menu item?
>
> The menu item calls a function. In that function you can do whatever
> you want, including opening a new form.
>
> Dim NewForm as new FormType
> NewForm.ShowDialog
>
>
> When I create my menu I do something like (this if for a context menu)
>
> ////
> RightClick.MenuItems.Add("&Edit", New EventHandler(AddressOf
> EditRecord))
> RightClick.MenuItems.Add("&New", New EventHandler(AddressOf
> NewRecord))
> RightClick.MenuItems.Add("&Delete", New EventHandler(AddressOf
> DeleteRecord))
> RightClick.MenuItems.Add("Re&conciled", New
> EventHandler(AddressOf MarkasReconciled))
> RightClick.MenuItems.Add("&Refresh", New EventHandler(AddressOf
> RefreshData))
> RightClick.MenuItems.Add("&Highlight", New
> EventHandler(AddressOf Highlight))
> \\\\
>
> You see that I add an EventHandler that points to a function
>
> Chris



  Reply With Quote
Old 15-03-2006, 11:07 AM   #5
Armin Zingler
Guest
 
Posts: n/a
Default Re: Visual Studio 2003 Menu on form.vb

"Phill Emery" <phill81_emery@hotmail.com> schrieb
> yes i want to know how to open a new form from a menu item.
>
> i have got this so far
>
> Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e
> As System.EventArgs) Handles MenuItem6.Click
>
> Dim FilmsToGet As New Form
>
> FilmsToGet.ShowDialog()
>
> and want to link menu item 6 to a form called FilmsToGet.vb, but
> this isnt working
>
> and i get this error at the top of the page.
>
> D:\My Documents\Visual Studio Projects\Film Database\Form1.vb(1):
> 'Class' statement must end with a matching 'End Class'.
>
>
> can you point me in the right direction please.



Maybe you only forgot the "End Sub" to close the Sub you've shown us above?


Armin
  Reply With Quote
Old 15-03-2006, 12:36 PM   #6
Phill Emery
Guest
 
Posts: n/a
Default Re: Visual Studio 2003 Menu on form.vb

no i have the end sub at the end, i just forgot to put that on the message
board


"Armin Zingler" <az.nospam@freenet.de> wrote in message
news:ONeuQKCSGHA.5656@TK2MSFTNGP11.phx.gbl...
> "Phill Emery" <phill81_emery@hotmail.com> schrieb
> > yes i want to know how to open a new form from a menu item.
> >
> > i have got this so far
> >
> > Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e
> > As System.EventArgs) Handles MenuItem6.Click
> >
> > Dim FilmsToGet As New Form
> >
> > FilmsToGet.ShowDialog()
> >
> > and want to link menu item 6 to a form called FilmsToGet.vb, but
> > this isnt working
> >
> > and i get this error at the top of the page.
> >
> > D:\My Documents\Visual Studio Projects\Film Database\Form1.vb(1):
> > 'Class' statement must end with a matching 'End Class'.
> >
> >
> > can you point me in the right direction please.

>
>
> Maybe you only forgot the "End Sub" to close the Sub you've shown us

above?
>
>
> Armin



  Reply With Quote
Old 15-03-2006, 02:31 PM   #7
Chris
Guest
 
Posts: n/a
Default Re: Visual Studio 2003 Menu on form.vb

Phill Emery wrote:
> yes i want to know how to open a new form from a menu item.
>
> i have got this so far
>
> Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MenuItem6.Click
>
> Dim FilmsToGet As New Form
>
> FilmsToGet.ShowDialog()
>
> and want to link menu item 6 to a form called FilmsToGet.vb, but this isnt
> working
>
> and i get this error at the top of the page.
>
> D:\My Documents\Visual Studio Projects\Film Database\Form1.vb(1): 'Class'
> statement must end with a matching 'End Class'.
>
>
> can you point me in the right direction please.
>
> Phill
>
>
> "Chris" <no@spam.com> wrote in message
> news:OmjJXZ5RGHA.5780@TK2MSFTNGP10.phx.gbl...
>
>>Phill Emery wrote:
>>
>>>hi can anyone please help me?
>>>
>>>Im new to visual studio 2003 and im trying to create a program in visual
>>>basic.
>>>The problem is i have put a menu bar onto the first form, and have

>
> created
>
>>>some other forms but cannot find any options to point from the menu to

>
> any
>
>>>of the other forms i have created.
>>>
>>>can anyone help me, as i would be very greatful
>>>
>>>Thanks Phill
>>>
>>>

>>
>>What do you mean, "point from the menu to any other forms"
>>
>>Are you asking how you open a new form from a menu item?
>>
>>The menu item calls a function. In that function you can do whatever
>>you want, including opening a new form.
>>
>>Dim NewForm as new FormType
>>NewForm.ShowDialog
>>
>>
>>When I create my menu I do something like (this if for a context menu)
>>
>>////
>> RightClick.MenuItems.Add("&Edit", New EventHandler(AddressOf
>>EditRecord))
>> RightClick.MenuItems.Add("&New", New EventHandler(AddressOf
>>NewRecord))
>> RightClick.MenuItems.Add("&Delete", New EventHandler(AddressOf
>>DeleteRecord))
>> RightClick.MenuItems.Add("Re&conciled", New
>>EventHandler(AddressOf MarkasReconciled))
>> RightClick.MenuItems.Add("&Refresh", New EventHandler(AddressOf
>>RefreshData))
>> RightClick.MenuItems.Add("&Highlight", New
>>EventHandler(AddressOf Highlight))
>>\\\\
>>
>>You see that I add an EventHandler that points to a function
>>
>>Chris

>
>
>


your logic for opening a form is fine, you have another problem in your
code. The error message is telling you that you don't have an End Class
at the bottom for your Form1 Class. If you can't figure it out, post
the code for Form1 in here so we can look at it.

Chris
  Reply With Quote
Old 15-03-2006, 06:19 PM   #8
Phill Emery
Guest
 
Posts: n/a
Default Re: Visual Studio 2003 Menu on form.vb

its ok now i have redone the entire thing after you said the code i did was
fine, and it works now

Thanks for the help

Phill

"Chris" <no@spam.com> wrote in message
news:%23BKoa0DSGHA.5900@tk2msftngp13.phx.gbl...
> Phill Emery wrote:
> > yes i want to know how to open a new form from a menu item.
> >
> > i have got this so far
> >
> > Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles MenuItem6.Click
> >
> > Dim FilmsToGet As New Form
> >
> > FilmsToGet.ShowDialog()
> >
> > and want to link menu item 6 to a form called FilmsToGet.vb, but this

isnt
> > working
> >
> > and i get this error at the top of the page.
> >
> > D:\My Documents\Visual Studio Projects\Film Database\Form1.vb(1):

'Class'
> > statement must end with a matching 'End Class'.
> >
> >
> > can you point me in the right direction please.
> >
> > Phill
> >
> >
> > "Chris" <no@spam.com> wrote in message
> > news:OmjJXZ5RGHA.5780@TK2MSFTNGP10.phx.gbl...
> >
> >>Phill Emery wrote:
> >>
> >>>hi can anyone please help me?
> >>>
> >>>Im new to visual studio 2003 and im trying to create a program in

visual
> >>>basic.
> >>>The problem is i have put a menu bar onto the first form, and have

> >
> > created
> >
> >>>some other forms but cannot find any options to point from the menu to

> >
> > any
> >
> >>>of the other forms i have created.
> >>>
> >>>can anyone help me, as i would be very greatful
> >>>
> >>>Thanks Phill
> >>>
> >>>
> >>
> >>What do you mean, "point from the menu to any other forms"
> >>
> >>Are you asking how you open a new form from a menu item?
> >>
> >>The menu item calls a function. In that function you can do whatever
> >>you want, including opening a new form.
> >>
> >>Dim NewForm as new FormType
> >>NewForm.ShowDialog
> >>
> >>
> >>When I create my menu I do something like (this if for a context menu)
> >>
> >>////
> >> RightClick.MenuItems.Add("&Edit", New EventHandler(AddressOf
> >>EditRecord))
> >> RightClick.MenuItems.Add("&New", New EventHandler(AddressOf
> >>NewRecord))
> >> RightClick.MenuItems.Add("&Delete", New EventHandler(AddressOf
> >>DeleteRecord))
> >> RightClick.MenuItems.Add("Re&conciled", New
> >>EventHandler(AddressOf MarkasReconciled))
> >> RightClick.MenuItems.Add("&Refresh", New EventHandler(AddressOf
> >>RefreshData))
> >> RightClick.MenuItems.Add("&Highlight", New
> >>EventHandler(AddressOf Highlight))
> >>\\\\
> >>
> >>You see that I add an EventHandler that points to a function
> >>
> >>Chris

> >
> >
> >

>
> your logic for opening a form is fine, you have another problem in your
> code. The error message is telling you that you don't have an End Class
> at the bottom for your Form1 Class. If you can't figure it out, post
> the code for Form1 in here so we can look at it.
>
> Chris



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off