|
-
Nov 8th, 2000, 10:37 PM
#1
Thread Starter
Hyperactive Member
textbox cursor position???
i never needed to know this until now ...
if i wanted to put text to a textbox all i would have to do was
text1.text = "hello"
and if i ever wanted to to put a line below that i would go
text1.text = "hello" & vbcrlf & "world"
however, now i need to insert words in the textbox with a command button ... i need it to insert the text where the blinking cursor is in the textbox ...
can anyone help?
-
Nov 8th, 2000, 11:31 PM
#2
Addicted Member
maybe if you explain more how/when this shouldhappen someone will be able to give you a better solution. For example, it can't happen after the user clicks on a button because the focus will no longer be with the textbox.
what is the scenario or the event that triggers th need to insert text?
-
Nov 9th, 2000, 06:20 AM
#3
SelStart = Where the selection begins
SelLength = How long is the selection
SelText = What it contains
Basically, you only need to set the SelText.
-
Nov 9th, 2000, 10:58 AM
#4
Thread Starter
Hyperactive Member
what i'm trying to do is a very simplistic html editor (if i can even call it that)
its purpose is to make my coding a little faster.
every time i might need to type <html> i just want to click on a command button and insert it wherever the blinking cursor is at ...
i hope i explained myself better
-
Nov 9th, 2000, 11:22 AM
#5
Text1.SelText = " Hello"
or
Text1.text = Text1.text & " Hello"
-
Nov 10th, 2000, 12:08 AM
#6
Thread Starter
Hyperactive Member
thanks
well that was really simple ... i thought it too simple to work so i didn't even bother to try that before ...
1 more question ... which one would be more effecient ?
Text1.SelText = " Hello"
or
Text1.text = Text1.text & " Hello"
-
Nov 10th, 2000, 12:21 AM
#7
Sorry for giving you a choice .
Well, .SelText will overwrite any selected and put the new text.
Whereas, Text1.text = Text1.text & ... will not overwrite any text, but will rather add to the textbox.
-
Nov 10th, 2000, 06:14 AM
#8
Text1.Text = Text1.Text & "Hello"
isn't what you're looking for.
Text1.SelText = "Hello"
replaces the text that is selected in the textbox (if there's no selected text, it adds Hello to the current cursor position.
If you wish to only add text, use
Text1.SelText = Text1.SelText & "Hello"
-
Nov 10th, 2000, 06:36 AM
#9
transcendental analytic
Nope, that's not really it either. Well what about this?
Code:
With Text1
.SelStart = .SelStart + .SelLength
.SelText = "Hello"
End With
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 10th, 2000, 04:38 PM
#10
Uh, too many posts about the same thing I think? 
Anyway, do and use as you like theman32x.
As a tip I can say that it's not good to add too many command buttons. You could make command buttons by category. When you click a button, you get a popup menu with the tags etc. that can be add to the HTML. It's simple to do and looks kinda cool
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
|