MENU EDITOR



AIM
          To create a menu using menu editor in Visual Basic 6.0.
PROCEDURE:
Step 1: Start the program
Step 2: Open a new standard exe project in VB and set its MDI child property 
                       To true to the form.
Step 3: Add a new MDI form.
Step 4: From the project menu add the various controls like Microsoft   
                            Rich textbox 6.0, Microsoft common dialog control, and Microsoft
                            Windows common controls 6.0.
 Step 5: In the form1 place the Rich textbox control.
 Step 6: In the MDI form, place a menu using menu editor option form.
                           Tools menu, add also toolbar control and change its properties.
 Step 7: Place Image list control and common dialog control and change its 
                            Properties, by adding images in toolbar.
 Step 8: Write the corresponding code for each click event of menus and
                         Buttons in the toolbar, Run the MDI form and execute the program.


SOURCE CODE:
Dim a As Integer
Private Sub Color_Click()
Form1.CommonDialog1.ShowColor
Form1.RichTextBox1.SelColor = Form1.CommonDialog1.Color
End Sub
Private Sub Copy_Click()
Clipboard.SetText (Form1.RichTextBox1.SelText)
End Sub
Private Sub Cut_Click()
Clipboard.SetText (Form1.RichTextBox1.SelText)
Form1.RichTextBox1.SelText = ""
End Sub
Private Sub Exit_Click()
End
End Sub
Private Sub Font_Click()
Form1.CommonDialog1.Flags = cdlCFScreenFonts
Form1.CommonDialog1.ShowFont
Form1.RichTextBox1.SelBold = Form1.CommonDialog1.FontBold
 Form1.RichTextBox1.SelFontSize = Form1.CommonDialog1.FontSize
Form1.RichTextBox1.SelFontName = Form1.CommonDialog1.FontName
End Sub
Private Sub MDIForm_Load()
Form1.Show
End Sub

Private Sub New_Click()
Form1.Show
Form1.RichTextBox1.Text = ""
End Sub

Private Sub Open_Click()
Form1.CommonDialog1.Filter = "textfile(*.txt)|*.txt"
Form1.CommonDialog1.ShowOpen
Form1.RichTextBox1.FileName = Form1.CommonDialog1.FileName
Form1.Caption = Form1.CommonDialog1.FileName
End Sub

Private Sub Paste_Click()
Form1.RichTextBox1.SelText = Clipboard.GetText
End Sub
Private Sub Save_Click()
Form1.CommonDialog1.ShowSave
Form1.RichTextBox1.SaveFile (Form1.CommonDialog1.FileName)
Form1.CommonDialog1.Filter = "textfile(*.txt)|*.txt"
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button)
a = Button.Index
'if me.Toolbar1.
If a = 1 Then
Form1.Show
Form1.RichTextBox1.Text = ""
ElseIf a = 2 Then
Form1.CommonDialog1.ShowSave
Form1.RichTextBox1.SaveFile (Form1.CommonDialog1.FileName)
Form1.CommonDialog1.Filter = "textfile(*.txt)|*.txt"
ElseIf a = 3 Then
Clipboard.SetText (Form1.RichTextBox1.SelText)
Form1.RichTextBox1.SelText = ""
ElseIf a = 4 Then
Clipboard.SetText (Form1.RichTextBox1.SelText)
ElseIf a = 5 Then
Form1.RichTextBox1.SelText = Clipboard.GetText
End If
End Sub



SCREEN LAYOUT:






                                                                                      







                               


0 comments: