Log in

View Full Version : eVB for beginners...


LKing
04-02-2003, 01:36 PM
OK. I added the MenuBar control to my tool box, double clicked it onto my form, clicked the menu box and added the following code:
Dim mnuFile As MenuBarLib.MenuBarMenu
Set mnuFile = MenuBar1.Controls.AddMenu("File", "mnuFile")
.......

I made sure the menubar control was available to both the emulator and PPC (2002) via the control manager...

when I run the code I get an error message saying MenuBar1 is an undefinded variable. Am I missing a library somewhere????

rhmorrison
04-02-2003, 02:22 PM
Constructing the Menu Bar
In piecing together this article, I became aware that I had not previously covered the topic of constructing a menu bar interface in detail in any of my previous Two for the Road articles. As such, I will correct that oversight here.

Unlike Visual Basic that has this graphical, easy-to-use menu editor, eMbedded Visual Basic forces you to build menus through code. The first time you do this can be a challenge, but once you have a sample, you can do what all good coder writers do, and simply copy from that one example again and again.

In the ePhoto Album application, the ConstructMenuBar subroutine handles building the menu bar. This routine starts by adding a single menu, Tools, along with three menu items, Open List, Modify List, and Display Pictures.

Sub ConstructMenuBar()
Dim mnuMenu As MenuBarMenu
Dim objButton As MenuBarButton

' Add menu items
Set mnuMenu = ceMenuBar.Controls.AddMenu("Tools", "tools")
mnuMenu.Items.Add , "mnuToolsOpen", "Open List"
mnuMenu.Items.Add , "mnuToolsList", "Modify List"
mnuMenu.Items.Add , "mnuToolsDisplay", "Display Pictures"

A separator is then added for interface cosmetic purposes.

' Add toolbar separator
Set objButton = ceMenuBar.Controls.AddButton("Separator1")
objButton.Caption = "X"
objButton.Style = mbrSeparator
objButton.Visible = True

LKing
04-02-2003, 06:14 PM
Now the error msg tells me "ceMenuBar" is an undefined variable.

rhmorrison
05-02-2003, 04:15 PM
Now the error msg tells me "ceMenuBar" is an undefined variable.
Take a look at Business Anyplace (http://www.businessanyplace.net/?p=evbcode#5.4) source code for eMbedded Visual Basic. They have a nice simple MenuBar example with source code (plus many others).

stlbud
05-11-2003, 02:09 PM
I'm new to eVB. I'm not able to get the Image Ctl to work. I want to put a graphic in my form. I have an appropriately sized .bmp file but it won't show in the form and won't show in the emulator. Can someone give me a step by step?

Thanks,
Bill B

denmage
06-14-2003, 12:42 PM
I'm new to eVB. I'm not able to get the Image Ctl to work. I want to put a graphic in my form. I have an appropriately sized .bmp file but it won't show in the form and won't show in the emulator. Can someone give me a step by step?

Thanks,
Bill B

Make sure your image file does not have more than 256 colors in its palette.

Denis

ozen
06-16-2003, 06:42 AM
Did you ever get your menubar to work? Well, if you didn't: open your project, click Project in the menu, then click Components, check Microsoft PocketPC Menubar Control 3.0 and click ok. Now to your far left double click on the very last item: the menubar and just put it in the corner of your Form(it doesn't matter the size), Finally go to the properties of the menubar control and rename it (if your using rhmorrison's example set the name to ceMenuBar) and start coding. Hope this helped.

ozen
06-16-2003, 06:48 AM
Here (http://justppc.com/evb4.shtml) is a tutorial on a PictureBox. I dont know if this is what your looking for so just post if it is or not and i'll look it up more for you.

zy_abc
08-19-2003, 02:44 PM
Hello All,

I get the error "Control MenuBar1 cannot be created". I get the similar message whenever i add a component. Can you please tell me why i get this message.

Thanks & Regards,
zy_abc