|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
HI. I am writing an app that needs to have the "Insert" key on the keyboard
enabled in a textbox. The textbox has text in it at startup but when the user clicks to edit the text, and begins to type, the existing text moves to the right. I noticed while writing code in the code editor that if I press "Insert" key then a colored square replaces the cursor allowing me to replace the highlighted text without the text moving to the right. That's exactly what I need to do. If you can and will help me it would be greatly appreciated. Sincerely, Brenton Garman "Brenton Garman" <BrentonGar***@discussions.microsoft.com> wrote in message Personally I like it that way ;-)news:D60B8A19-1F4C-4F04-84D2-ED5E5083891F@microsoft.com... > . . . The textbox has text in it at startup but when the user > clicks to edit the text, and begins to type, the existing text > moves to the right. > while writing code in the code editor that if I press "Insert" Yuck! I hate that, and I turn it off immediately if I ever do it by > key then a colored square replaces the cursor allowing me > to replace the highlighted text [as I type] accident! However, I suppose it is one of the standard ways of doing things, so here is one way of doing it . . . Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii <> 8 Then Text1.SelLength = 1 End If End Sub By the way, it is only the VB editr that automatically highlights the character that is about to be replaced if you press a key. Other applications (Microsoft Word, for example)do not d that (nd neither does the code above). However, if yu really would like a visible indication that you are in "replace" mode then you can add code to do it for you. One of the easiest ways is to make the text cursor a bit "fatter" than it normally is, which isn't too difficult to do. Mike First off, I want to thank you for so speedily answering my question,
however, let me rephrase my question: "Upon startup, I need the textbox, without the user pressing the "Insert" Key, to have the behavior as though the user did press the "Insert" Key. This is for a Guitar Tab-Editor.... |- - - - - 7- - - - - -| See how the text moves to the right? Now I set the sellength as follows:|- - - - - - - - - - -| |- - - - -4^ - - - - - -| |- - - - - - - - - - -| |- - - - - - - - - - -| |- - - - - - - - - - -| Private Sub RichTextBox1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RichTextBox1.SelectionChanged Me.RichTextBox1.SelectionLength = 2 End Sub This only works for most letters and numbers. Like "p" still pushes the text to the right, wheras "h" won't. So I need to be able to "Replace" selected text without moving text to right. Thank you so much for your time..... Brenton Show quoteHide quote "Mike Williams" wrote: > "Brenton Garman" <BrentonGar***@discussions.microsoft.com> wrote in message > news:D60B8A19-1F4C-4F04-84D2-ED5E5083891F@microsoft.com... > > > . . . The textbox has text in it at startup but when the user > > clicks to edit the text, and begins to type, the existing text > > moves to the right. > > Personally I like it that way ;-) > > > while writing code in the code editor that if I press "Insert" > > key then a colored square replaces the cursor allowing me > > to replace the highlighted text [as I type] > > Yuck! I hate that, and I turn it off immediately if I ever do it by > accident! However, I suppose it is one of the standard ways of doing things, > so here is one way of doing it . . . > > Private Sub Text1_KeyPress(KeyAscii As Integer) > If KeyAscii <> 8 Then > Text1.SelLength = 1 > End If > End Sub > > By the way, it is only the VB editr that automatically highlights the > character that is about to be replaced if you press a key. Other > applications (Microsoft Word, for example)do not d that (nd neither does the > code above). However, if yu really would like a visible indication that you > are in "replace" mode then you can add code to do it for you. One of the > easiest ways is to make the text cursor a bit "fatter" than it normally is, > which isn't too difficult to do. > > Mike > > > > > "Brenton Garman" <BrentonGar***@discussions.microsoft.com> wrote in message .. . . hang on a minute! What's all this "SelectionChanged(ByVal sender As news:3C1CA038-DDE5-4CBB-992A-56BDA497A374@microsoft.com... Object, ByVal e As System.EventArgs)" stuff? I'm afraid you're on the wrong newsgroup Brenton. That stuff is dotnet code, whereas this newsgroup is for "Classic VB" (up to version VB6). I blame that Billy Gate$ fella for putting the word "Basic" into his new fangled dotnet money spinner in what I personally consider to be a dishonest attempt to persuade people to buy it who otherwise might not do so. Not your fault, of course, but you need to post your question on a dotnet group. Mike Hello, Brenton,
Yes, Mike is right. If you want a .Net solution, you should put this in a .Net newsgroup. Try "microsoft.public.dotnet.languages.vb". If you do, I will try to give you an answer there. (If you really want ideas for VB6 though, repeat/confirm the request here.) Cheers, Randy Ooops, My Bad. Sorry Guys. I'll go post at the place you suggested
Mr.R.Macdonald. And BTW, if you decide to upgrade from vb6, my experience is that .Net 2003 is much more stable and effective version than 2005. Show quoteHide quote "R. MacDonald" wrote: > Hello, Brenton, > > Yes, Mike is right. If you want a .Net solution, you should put this in > a .Net newsgroup. Try "microsoft.public.dotnet.languages.vb". > > If you do, I will try to give you an answer there. > > (If you really want ideas for VB6 though, repeat/confirm the request here.) > > Cheers, > Randy >
Microsoft SAPI 5.0 - Is there something better out there?
Adding MS Access type record navigation buttons to a form Find most similar filename Finding child? windows Retval - Shell program run problem with parameters HiEdit Pro Sending Email with VB DAO Control Find Method VB6 keeps asking for VisualStudio 2005 DVD VB making a CSV from a filename |
|||||||||||||||||||||||