|
-
Jul 6th, 2000, 06:57 AM
#1
Thread Starter
Lively Member
Hey guys,
I am creating an editor of my own for a VB project. I have been able to implement New, Open and Exit commands successfully. But I am stuck with Cut, Copy, Paste and Delete features of the Implementation.
Do you guys have an suggestions on how to implement the cut, copy, paste, and delete actions(Even the logic aspect will be sufficient)? Thank you in advance.
Manoj
-
Jul 6th, 2000, 07:40 AM
#2
Fanatic Member
Hi sweetsupra,
Look into using the Clipboard object. That's where I would start.
All the best.
-
Jul 6th, 2000, 08:49 AM
#3
OneSource is correct, the best way to do this is with the Clipboard. Here's the code (unabashedly stolen from a textbook by Diane Zak, "Programming with Microsoft Visual Basic X.0" (X.0 = 4.0, 5.0, 6.0 etc.) - great book for beginners, btw).
The following code assumes that you have a menu item named "mnuEdit" with sub-items named "mnuCopy", "mnuCut", "mnuPaste", and "mnuDelete", and that your textbox is called txtEdit:
Code:
Private Sub mnuEdit_Click()
' enable/disable copy and cut commands, depending
' on whether any text is selected ...
If txtEdit.SelText = "" Then
mnuCut.Enabled = False
mnuCopy.Enabled = False
Else
mnuCut.Enabled = True
mnuCopy.Enabled = True
End If
' enable/disable Paste command, depending on
' whether or not any text is in the Clipboard ...
If Clipboard.GetText() = "" Then
mnuPaste.Enabled = False
Else
mnuPaste.Enabled = True
End If
End Sub
Private Sub mnuCopy_Click()
Clipboard.Clear
Clipboard.SetText txtEdit.SelText
End Sub
Private Sub mnuCut_Click()
Clipboard.Clear
Clipboard.SetText txtEdit.SelText
txtEdit.SelText = ""
End Sub
Private Sub mnuPaste_Click()
txtEdit.SelText Clipboard.GetText()
End Sub
Private Sub mnuDelete_Click()
txtEdit.SelText = ""
End Sub
"It's cold gin time again ..."
Check out my website here.
-
Aug 3rd, 2003, 12:50 PM
#4
Junior Member
Try the Visual Basic Application Wizard first.I learnt a lot of things from it. File->New Project. then VB Application Wizard.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|