emia
08-08-2009, 04:16 AM
I have Problem:
Text1.Text ; MultLine = True
I need Real-Time to catch that string. First I need get last_line that string, detect last_line , is enter type "="
if first char is enter "=" ,
Text1.BackColor = RED
And if same_line that Last char is same "="
Doing Msgbox, String, Something
if same_line, only Left "=", and vbCrLf
Text1.BackColor = YELLOW
this code where wrong please!
Problem (1)
Use Option Explicit;
How to correct "Dim yyy As String/Long/Integer... ? ;
Problem (2)
If Text1.Text only press ENTER, that Array() Error #9
"Run-time error '9': Subscript out of range"
Problem (3)
I no sure total need "lines" in Text1.Text, if used
Dim line_to_Array(65535) As String 'Is large problem ?
Problem (4)
What mean "8454016" ?
'Option Explicit
'///////////////////////////////////////
Private Sub Form_Load()
Text1.Text = ""
'Dim line_to_Array() As Variant
Dim last_string As String
Dim output_A As String
End Sub
'//////////////////////////////
Private Sub Text1_KeyPress(KeyAscii As Integer)
'Detect:
'Step 1 , Get Last Line Text String
If KeyAscii = 13 Then
line_to_Array = Split(Text1.Text, vbCrLf)
'
If IsArray(line_to_Array) = True Then
last_string = line_to_Array(UBound(line_to_Array))
Else
last_string = ""
End If
End If
'Step 2,
'Confirm First Chr = "=" Chr(61)
'Text1.BackColor = &HC0C0FF 'red
If Mid$(last_string, 1, 1) = Chr(61) Then
Text1.BackColor = &HC0C0FF
'If confirm First,Left 1 = Chr(61), and Right 1 = Chr(61)
If Mid$(last_string, Len(last_string), 1) = Chr(61) Then
'Text1.Text = &H80FF80 'green
Text1.Text = &H80FF80
'"=Text Happy=" Return "Text Happy"
output_A = Mid$(last_string, 2, Len(last_string) - 2)
Debug.Print output_A
Exit Sub
End If
End If 'Left=
End Sub '/Private Sub Text1_KeyPress(KeyAscii As Integer)
Text1.Text ; MultLine = True
I need Real-Time to catch that string. First I need get last_line that string, detect last_line , is enter type "="
if first char is enter "=" ,
Text1.BackColor = RED
And if same_line that Last char is same "="
Doing Msgbox, String, Something
if same_line, only Left "=", and vbCrLf
Text1.BackColor = YELLOW
this code where wrong please!
Problem (1)
Use Option Explicit;
How to correct "Dim yyy As String/Long/Integer... ? ;
Problem (2)
If Text1.Text only press ENTER, that Array() Error #9
"Run-time error '9': Subscript out of range"
Problem (3)
I no sure total need "lines" in Text1.Text, if used
Dim line_to_Array(65535) As String 'Is large problem ?
Problem (4)
What mean "8454016" ?
'Option Explicit
'///////////////////////////////////////
Private Sub Form_Load()
Text1.Text = ""
'Dim line_to_Array() As Variant
Dim last_string As String
Dim output_A As String
End Sub
'//////////////////////////////
Private Sub Text1_KeyPress(KeyAscii As Integer)
'Detect:
'Step 1 , Get Last Line Text String
If KeyAscii = 13 Then
line_to_Array = Split(Text1.Text, vbCrLf)
'
If IsArray(line_to_Array) = True Then
last_string = line_to_Array(UBound(line_to_Array))
Else
last_string = ""
End If
End If
'Step 2,
'Confirm First Chr = "=" Chr(61)
'Text1.BackColor = &HC0C0FF 'red
If Mid$(last_string, 1, 1) = Chr(61) Then
Text1.BackColor = &HC0C0FF
'If confirm First,Left 1 = Chr(61), and Right 1 = Chr(61)
If Mid$(last_string, Len(last_string), 1) = Chr(61) Then
'Text1.Text = &H80FF80 'green
Text1.Text = &H80FF80
'"=Text Happy=" Return "Text Happy"
output_A = Mid$(last_string, 2, Len(last_string) - 2)
Debug.Print output_A
Exit Sub
End If
End If 'Left=
End Sub '/Private Sub Text1_KeyPress(KeyAscii As Integer)