usetheforce2
10-01-2001, 01:15 PM
hey all,
i'm writting an app the requires the user to type in lines of code at a command prompt. When the user presses enter, i want to be able to capture the new line of text the user entered...
Exmaple
080A = CC 04 7B <- user pressed "ENTER"
080B = 86 12 34 <- user pressed "ENTER"
080C = 17 C6 7B <- user pressed "ENTER"
so everytime the user hits enter i would like to get the last line entered (080C = 17 C6 7B) . For this i was using the SelStart, SelLength and SelStart properties of the list box. The problem is that is removes the text from the text box, rather than copy it!!
this is my code:
<pre><font color=blue>Private Sub</font color=blue> text1_KeyPress(KeyAscii <font color=blue>As Integer</font color=blue>)
<font color=blue>Static</font color=blue> Position <font color=blue>As Integer</font color=blue>
<font color=blue>If</font color=blue> KeyAscii = 13 <font color=blue>Then</font color=blue> <font color=green>'<- return</font color=green>
<font color=green>' set start position of last carriage return</font color=green>
text1.SelStart = Position
<font color=green>' get length of new characters since last "enter"</font color=green>
text1.SelLength = Len(text1.Text) - Position
<font color=green>' reset the position for the next carriage return</font color=green>
Position = Len(text1.Text) + 1
<font color=green>' save new text in variable to be proccessed</font color=green>
mystr = text1.SelText
<font color=blue>End If</font color=blue>
<font color=blue>End Sub</font color=blue>
</pre>
any suggestions would be great!
Regan
"The crows seem to be calling his name, thought Caw." - Jack Handy
i'm writting an app the requires the user to type in lines of code at a command prompt. When the user presses enter, i want to be able to capture the new line of text the user entered...
Exmaple
080A = CC 04 7B <- user pressed "ENTER"
080B = 86 12 34 <- user pressed "ENTER"
080C = 17 C6 7B <- user pressed "ENTER"
so everytime the user hits enter i would like to get the last line entered (080C = 17 C6 7B) . For this i was using the SelStart, SelLength and SelStart properties of the list box. The problem is that is removes the text from the text box, rather than copy it!!
this is my code:
<pre><font color=blue>Private Sub</font color=blue> text1_KeyPress(KeyAscii <font color=blue>As Integer</font color=blue>)
<font color=blue>Static</font color=blue> Position <font color=blue>As Integer</font color=blue>
<font color=blue>If</font color=blue> KeyAscii = 13 <font color=blue>Then</font color=blue> <font color=green>'<- return</font color=green>
<font color=green>' set start position of last carriage return</font color=green>
text1.SelStart = Position
<font color=green>' get length of new characters since last "enter"</font color=green>
text1.SelLength = Len(text1.Text) - Position
<font color=green>' reset the position for the next carriage return</font color=green>
Position = Len(text1.Text) + 1
<font color=green>' save new text in variable to be proccessed</font color=green>
mystr = text1.SelText
<font color=blue>End If</font color=blue>
<font color=blue>End Sub</font color=blue>
</pre>
any suggestions would be great!
Regan
"The crows seem to be calling his name, thought Caw." - Jack Handy