Monday, December 10, 2012

Displaying Menu and popup menu in visual basic


Private Sub forered_Click()
Txtnum1.ForeColor = RGB(255, 0, 0)
End Sub

Private Sub foregreen_Click()
Txtnum1.ForeColor = RGB(0, 255, 0)
End Sub

Private Sub foreblue_Click()
Txtnum1.ForeColor = RGB(0, 0, 255)
End Sub
Private Sub backred_Click()
Txtnum1.BackColor = RGB(255, 0, 0)
End Sub
Private Sub backgreen_Click()
Txtnum1.BackColor = RGB(0, 255, 0)
End Sub

Private Sub backblue_Click()
Txtnum1.BackColor = RGB(0, 0, 255)
End Sub
Private Sub fbold_Click()
If fbold.Checked = True Then
fbold.Checked = False
Else
fbold.Checked = True
End If
If fbold.Checked = True Then
Txtnum1.FontBold = True
Else
Txtnum1.FontBold = False
End If
End Sub
Private Sub fitalic_Click()
If fitalic.Checked = True Then
fitalic.Checked = False
Else
fitalic.Checked = True
End If
If fitalic.Checked = True Then
Txtnum1.FontItalic = True
Else
Txtnum1.FontItalic = False
End If
End Sub
Private Sub funderline_Click()
If funderline.Checked = True Then
funderline.Checked = False
Else
funderline.Checked = True
End If
If funderline.Checked = True Then
Txtnum1.FontUnderline = True
Else
Txtnum1.FontUnderline = False
End If
End Sub
Private Sub fstrikethru_Click()
If fstrikethru.Checked = True Then
fstrikethru.Checked = False
Else
fstrikethru.Checked = True
End If
If fstrikethru.Checked = True Then
Txtnum1.FontStrikethru = True
Else
Txtnum1.FontStrikethru = False
End If
End Sub
Private Sub ecut_Click()
Clipboard.SetText Txtnum1.SelText
Txtnum1.SelText = ""
End Sub
Private Sub ecopy_Click()
Clipboard.SetText Txtnum1.SelText
End Sub

Private Sub epaste_Click()
Txtnum1.SelText = Clipboard.GetText
End Sub

Private Sub eselectall_Click()
Txtnum1.SelStart = 0
Txtnum1.SelLength = Len(Txtnum1.Text)
Txtnum1.SetFocus
End Sub
Private Sub mnuexit_Click()
End
End Sub




 Output









Note:- Please set some property of your control like caption or id corresponding to your control
Goto Visual Basic Programs Index Page