|
-
Aug 31st, 2000, 10:12 PM
#1
Im trying to replicate the way Visual Basic does its commenting when you click on the comment button in the editing toolbar it will comment all the lines you have selected or the line you have selected..But I cant figure out how to get it to put the ' character as the first character in all the lines..Does anyone know how to do this?
-
Aug 31st, 2000, 10:29 PM
#2
Hyperactive Member
Try adding this (Syntax may need work, its off the top of my head)
Code:
RichTextBox.SelText = Replace(RichTextBox.SelText,vbCR,vbCR & "'")
You might need to change vbCR to vbCRLF and you might need to pass all but the last character of the .SelText so it doesn't put a ' on the line after your selection.
-
Aug 31st, 2000, 10:34 PM
#3
I tried this and it worked ok but if you highlight the text using your mouse going from bottom to top.. it misses the last line of code becuase you dont hightlight the line character feeds at the end of the line...to the user this wont make since because that line is highlighted..
-
Aug 31st, 2000, 10:42 PM
#4
Hyperactive Member
Selecting the entire text and only using all but 1 single character of the last line should still make the last line be commented out.
The reason for this is that the comment FOLLOWS the Carriage Return and regardless whether the last line ends in a Carriage Return or just ends it will do it because the one before is the reason THIS line gets it.
Paste the code in here and I will see where you have missed it
-
Aug 31st, 2000, 10:55 PM
#5
Code:
Dim Buffer As Variant
Dim i As Integer
If txtMain.SelLength = 0 Then
txtMain.SelText = "#"
Else
Buffer = txtMain.SelText
txtMain.SelText = Replace(Buffer, vbCr, vbCr & "'")
End If
Returns this
d
'
fafdjfkldsjf;lkdjfkdljdsf
'
fsd
'
d
'
d
'
-
Sep 1st, 2000, 02:18 AM
#6
yeah it was vblf.. thanks man...
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
|