Thursday, April 29, 2010

creating menu bar in visual basic


Menu Editor:-

Using this command we can create the menus in our form as well as can work dynamically.

Creating menu process:-

1. go to tools menu.(ctrl+E).

2. click on menu editor.

Or

a. Right click on form.

b. Click on menu editor.


The menu editor’s options:-

Caption:-write the menu’s caption.

Name:-write down the name of menu that should be unique.

Shortcut:-Through this we can set the shortcut key for menu.

Checked:-If you check on it display the check sign in menu.

Arrows:-Used to create the sub menu in the main and move up and down.

Next:-create new after the existing menu.

Insert :-create new.

Delete:-To delete the created menu.

Creating line in the Sub menu:-

Write das in Caption( -) and name as well as move one arrow inside.

Creating hotkeys:-

Write down the ampersand(&) before the letters of menu.

Creating shortcut keys:-

Choose the shortcut key for the sub menu as far as possible you need to choose the shortcut key for useable ,the useable shortcut key.Like to create the shortcut key for open ctrl+o.

Writing code in menu:-

After creating the menu in the design view using menu editor use the following ways to write the code in the menu editor:-

a. click on menu in the design time,that creates the event procedure in code.

b. Write down the code according to the menu purposes.

Example of some menu codes:-

Private Sub mnuclose_Click()

Form1.Hide

End Sub

Private Sub mnuexit_Click()

End

End Sub

Private Sub mnufontname_Click()

cd.Flags = cdlCFBoth

cd.ShowFont

rt.SelFontName = cd.FontName

End Sub

Private Sub mnufontsize_Click ()

cd.Flags = cdlCFBoth

cd.ShowFont

rt.SelFontSize = cd.FontSize

End Sub

Private Sub mnuforecolor_Click()

cd.ShowColor

rt.SelColor = cd.Color

End Sub

Private Sub mnuopen_Click ()

On Error GoTo pp:

cd.ShowOpen

fn = cd.FileName

rt.LoadFile (fn)

Exit Sub

pp:

Resume Next

End Sub

Private Sub mnusave_Click ()

cd.ShowSave

FN = cd.FileName

rt.SaveFile (FN)

End Sub

Microsoft windows common control 5.0 (sp2):-

It is the complex control used to provide the many graphical effects with many advanced controls. There are many controls in the MWCC 5.0 like progress bar,status bar,toolbar ,etc.

Progress bar:-

It is one of the member of MWCC 5.0 ,used to display the processing of the programme.

Without the timer the progress bar has no use. So that we need the timer together with the progress bar.

Getting progressbar:-

1. go to component.

2. Check on the Microsoft windows common control 5.0(sp2).

3. Click on apply and close.

4. It is on the tool bar ,draw the progress bar.

The properties of the Progress bar:-

Min:-It is the starting point of the progressbar the default value of the progress bar is Zero(0).

Max:-It is the ending point of the progress bar.The default value of pbr's max is 100.

Alignment:-There are four alignment using these we can set the progress bar in the particular location.

Value:-It is also the important property used to specify the how much of the progress bar making visible.

Example:

Private Sub Form_Load()

tmrpbr.Interval = 100

End Sub

Private Sub tmrpbr_Timer()

pbr.Value = pbr.Value + 1

If pbr.Value >= 100 Then

'pbr.Value = 0

pbr.Enabled = False

Unload Me

Form2.Show

End If

End Sub


For Further Reading,
Software Developing

0 comments:

Post a Comment

 

Popular Posts

Man Behind This Blog