Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB6 Oracle
Private Sub Combo14_LostFocus()
Dim x() As String
x = Split(Text2.Text, " ")
    If x(0) <> Empty Then
        Combo14.Text = Text2.Text
    If UBound(x) Then
        Combo14.Text = x(0)
    Else
    If UBound(x) Then
        Combo14.Text = x(1)
    Else
    If UBound(x) Then
        Combo14.Text = x(2)
    End If
    End If
    End If
    End If
End Sub
 
Private Sub Text2_LostFocus()
If Text2.Text = Empty Then Exit Sub
Dim STR() As String
STR = Split(Text2.Text, " ")
If STR(0) <> Empty Then
Combo14.Text = STR(0)
End If
End Sub
 
Is this code suitable for the operation like:
Splitting names from text boxes(firstname-text2,middlename-text3,lastname-text4)to populate list into combo box(combo14) and combo box should show only those records related to the name entered into either of text boxes not other than them.In one way I am going to use text box as a search box.
Same code as text2,I have written for text3 and text 4
While running this code combo box shows all the records(full-names). Not the specific text related full-names.
Please help me regarding this point.
Whether my point is not understood by anybody??????
please try to understand
Posted 31-Dec-12 20:38pm
surkhi623
Edited 1-Jan-13 0:05am
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

    If x(0) <> Empty Then
        Combo14.Text = Text2.Text
    If UBound(x) Then
        Combo14.Text = x(0)
    Else
    If UBound(x) Then
        Combo14.Text = x(1)
    Else
    If UBound(x) Then
        Combo14.Text = x(2)
    End If
The above sequence does not make much sense. If there is at least one word in your original string then you set the Text item of the combo box to the complete string. You then check if there is more than 1 substring in the array, and if so you try to set it to each three separate items.
 
Take a look at the documentation[^] to check what you want to do.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 425
1 OriginalGriff 165
2 DamithSL 130
3 Dave Kreskowiak 120
4 Suvendu Shekhar Giri 110
0 OriginalGriff 7,645
1 DamithSL 5,614
2 Sergey Alexandrovich Kryukov 5,344
3 Maciej Los 4,961
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 1 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100