But when installed support multiline Text mode, in the second line of the input, there is no 'display drop-down keyword'
Always in the first line of input to pop-up drop-down list keywords, to realize the objective effect is like that, always start with the Text cursor position pop-up drop-down keyword input, such as the IDE automatically completion function
Please advise, thank you
Private Sub Form_Load ()
List1. Visible=False
List2. Visible=False
Text1. Text=""
List2. AddItem "adljfdfjl
"List2. AddItem "adljfdfj
"List2. AddItem "adljf
"List2. AddItem "JFDFJL
"List2. AddItem "JFDF
"List2. AddItem "jf
"List2. AddItem "FDFJL
"List2. AddItem "fd"
End Sub
Private Sub list1_Mouseup (Button As an Integer, Shift the As an Integer, As Single X, Y As Single)
If the Button=1 Then Call List1_KeyPress (vbKeyLButton)
End Sub
Private Sub Text1_KeyUp (KeyCode As an Integer, Shift the As an Integer)
If List1. ListCount & lt;> 0 Then
If KeyCode=vbKeyUp Or KeyCode=vbKeyDown Then List1. SetFocus: SendKeys "{UP}
"End the If
End Sub
Private Sub List1_KeyPress (KeyAscii As Integer)
The Select Case KeyAscii
Case vbKeyLButton vbKeyReturn, vbKeySpace
Text1. Text=List1. Text
List1. Clear
List1. Visible=False
End the Select
End Sub
Private Sub Text1_Change ()
Dim I As Byte
If Text1. Text & lt;> "" Then
List1. Clear
For I=0 To List2. ListCount
If InStr (List2. List (I), Text1. Text)=1 Then List1. AddItem List2. List (I)
Next
List1. Visible=True
List1. Height=300 + List1. ListCount * List1. FontSize * 12
If List1. ListCount=0 Then List1. Visible=False
The Else
List1. Visible=False
End the If
End Sub
CodePudding user response:
Multiline mode content may contain a carriage return, direct use of instr will not, of course, you get the data...CodePudding user response:
You can use the text1. Selstart properties found VBBCRLF forward, so as to get the current lines, then instr can list the items match...