APPLICATION WITH MENUS
coding:-
Dim a, a1 As String
Dim n As Integer
Dim x, y As String
Private Sub Form_Load()
MsgBox "welcome to vb"
End Sub
Exit:
Private Sub mnuclose_Click()
End
End Sub
Copy:
Private Sub mnucopy_Click()
a = RT1.SelText
mnucut.Enabled = False
mnucopy.Enabled = False
End Sub
Cut:
Private Sub mnucut_Click()
a = RT1.SelText
RT1.SelText = ""
mnucut.Enabled = False
mnucopy.Enabled = False
End Sub
Find:
Private Sub mnufind_Click()
a1 = InputBox ("Enter the letter to find :")
RT1.Find (a1)
n = 1
End Sub
Find next:
Private Sub mnufindnext_Click()
n = InStr (n + 1, RT1.Text, a1)
If n > 0 Then
RT1.SelStart = n - 1
RT1.SelLength = Len (a1)
RT1.SetFocus
Else
MsgBox "String not found"
End If
End Sub
Paste:
Private Sub mnupaste_Click ()
RT1.SelRTF = a
mnucut.Enabled = True
mnucopy.Enabled = True
End Sub
Replace:
Private Sub mnureplace_Click()
x = InputBox ("Enter the letter to find :")
y = InputBox ("Enter the letter to Replace :")
t = RT1.Find(x)
RT1.SelText = y
End Sub
Replace all:
Private Sub mnureplaceall_Click ()
x = InputBox ("Enter the letter to find")
y = InputBox ("Enter the letter to Replace :")
n = Len (RT1.Text)
For i = 1 To n
t = RT1.Find(x, RT1.SelStart + RT1.SelLength, n)
If t < 0 Then Exit For
RT1.SelText = y
Next i
End Sub
OUTPUT: