SlideShare a Scribd company logo
Code help for Menu, pop up menu

If Button = vbRightButton Then PopupMenu Me.mnuPopup




Private txtName_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As
Single)

If Button=vbRightButton Then

PopupMenu mnuEdit

End If

End Sub



How do I find out what menu item was clicked

str = popMenu.Name
Select Case str
Case "mCut"
MsgBox "cut"
Case "mPaste"
MsgBox "paste"
Case "mProperties"
MsgBox "pro"

End Select



Popup menu coding

         Private Sub lblTestText_MouseDown(Button As Integer, _
                                           Shift As Integer, _
                                           X As Single, _
                                           Y As Single)

             If Button = vbRightButton Then
                 PopupMenu mnuPopUpFormat, vbPopupMenuRightButton
             End If

         End Sub
Code for bold
      Private Sub mnuBold_Click()

           If mnuBold.Checked Then
                lblTestText.FontBold = False
                mnuBold.Checked = False
           Else
                lblTestText.FontBold = True
                mnuBold.Checked = True
           End If

      End Sub

Code the mnuItalic_Click and mnuUnderline_Click events in a similar fashion as shown
      below.
      Private Sub mnuItalic_Click()

           If mnuItalic.Checked Then
                lblTestText.FontItalic = False
                mnuItalic.Checked = False
           Else
                lblTestText.FontItalic = True
                mnuItalic.Checked = True
           End If

      End Sub

      Private Sub mnuUnderline_Click()

           If mnuUnderline.Checked Then
                lblTestText.FontUnderline = False
                mnuUnderline.Checked = False
           Else
                lblTestText.FontUnderline = True
                mnuUnderline.Checked = True
           End If

      End Sub




MsgBox "Code for 'Print' goes here.", vbInformation, "Menu Demo"



      Private Sub mnuBold_Click()
      If mnuBold.Checked Then
      lblTestText.FontBold = False
      mnuBold.Checked = False
Else
lblTestText.FontBold = True
mnuBold.Checked = True
End If
End Sub

More Related Content

PPT
Control flow in c
PDF
I keep getting a BC30389 'System.Currency' is not accessible in this context ...
PPT
Vb basics
PPT
File handling
PDF
Visual basic menu
PPT
Visual Basic menu
PPTX
Filehandling
DOC
Report on telnet
Control flow in c
I keep getting a BC30389 'System.Currency' is not accessible in this context ...
Vb basics
File handling
Visual basic menu
Visual Basic menu
Filehandling
Report on telnet

Viewers also liked (14)

PPT
VB Codes
PPTX
Standard Algorithms
DOC
PDF
The Best Source Code VB
PDF
TELNET Protocol
PDF
Visual Basic 6.0
PPT
Presentation on telnet
PPS
Ip address
PPT
Introduction to visual basic programming
PPT
Ip address and subnetting
PPT
TCP/IP Network ppt
PPTX
Internet protocol (ip) ppt
PPT
Visual basic ppt for tutorials computer
PPT
Visual Basic Codes And Screen Designs
VB Codes
Standard Algorithms
The Best Source Code VB
TELNET Protocol
Visual Basic 6.0
Presentation on telnet
Ip address
Introduction to visual basic programming
Ip address and subnetting
TCP/IP Network ppt
Internet protocol (ip) ppt
Visual basic ppt for tutorials computer
Visual Basic Codes And Screen Designs
Ad

More from Amandeep Kaur (20)

PPTX
Video/ Graphics cards
PPTX
Menu pop up menu mdi form and playing audio in vb
PPT
Active x control
PPTX
Image contro, and format functions in vb
PPTX
Data base connectivity and flex grid in vb
PPTX
Toolbar, statusbar, coolbar in vb
PPTX
Richtextbox
PPTX
Treeview listview
PPTX
Progress bar
DOC
PPT
Ppt of socket
PPT
Introduction to computer graphics
PPT
Introduction to computer graphics
PPT
Introduction to computer graphics
PPT
Internet
DOCX
Internet working
DOC
Report on browser war
DOC
Report of internet connections
DOCX
Report on intranet
DOC
How to configure dns server(2)
Video/ Graphics cards
Menu pop up menu mdi form and playing audio in vb
Active x control
Image contro, and format functions in vb
Data base connectivity and flex grid in vb
Toolbar, statusbar, coolbar in vb
Richtextbox
Treeview listview
Progress bar
Ppt of socket
Introduction to computer graphics
Introduction to computer graphics
Introduction to computer graphics
Internet
Internet working
Report on browser war
Report of internet connections
Report on intranet
How to configure dns server(2)
Ad

Menu vb

  • 1. Code help for Menu, pop up menu If Button = vbRightButton Then PopupMenu Me.mnuPopup Private txtName_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button=vbRightButton Then PopupMenu mnuEdit End If End Sub How do I find out what menu item was clicked str = popMenu.Name Select Case str Case "mCut" MsgBox "cut" Case "mPaste" MsgBox "paste" Case "mProperties" MsgBox "pro" End Select Popup menu coding Private Sub lblTestText_MouseDown(Button As Integer, _ Shift As Integer, _ X As Single, _ Y As Single) If Button = vbRightButton Then PopupMenu mnuPopUpFormat, vbPopupMenuRightButton End If End Sub
  • 2. Code for bold Private Sub mnuBold_Click() If mnuBold.Checked Then lblTestText.FontBold = False mnuBold.Checked = False Else lblTestText.FontBold = True mnuBold.Checked = True End If End Sub Code the mnuItalic_Click and mnuUnderline_Click events in a similar fashion as shown below. Private Sub mnuItalic_Click() If mnuItalic.Checked Then lblTestText.FontItalic = False mnuItalic.Checked = False Else lblTestText.FontItalic = True mnuItalic.Checked = True End If End Sub Private Sub mnuUnderline_Click() If mnuUnderline.Checked Then lblTestText.FontUnderline = False mnuUnderline.Checked = False Else lblTestText.FontUnderline = True mnuUnderline.Checked = True End If End Sub MsgBox "Code for 'Print' goes here.", vbInformation, "Menu Demo" Private Sub mnuBold_Click() If mnuBold.Checked Then lblTestText.FontBold = False mnuBold.Checked = False