Go Premium for a chance to win a PS4. Enter to Win


Number Search in combo box of  vsflexgrid.

Posted on 2001-08-01
Medium Priority
Last Modified: 2007-12-19

I am creating one accounting application.
In the application i have purchase screen wherein user can purchase number of product in an order.
To show Products in purchase order i have used vsflexgrid.
In vsflexgrid user can add/modify the products.

Now i have one problem,
I am having combo box in first columns of vsflexgrid, combo box shows all the product number available in database.
Let us say i have product numbers like 1,10,11,2,23,50,100, etc.
Combox box in vsflexgrid shows all these product number.

When typing in the grid, autofill works when I type a 1 it brings up
Product 1 and when I type a 5 it brings up item 50 but when I type 10 it doesn't bring up anything.

What i need is if user type 10 then the combo box of the grid should show number 10, etc.

Any help in this regards will be highly appreciated.

Thanks in advance.


Question by:sudarshan_shir

Expert Comment

ID: 6343980
In the Form's Gen. Dec. section, add:

Private SkipChange As Boolean

In the combobox's change event, compare what the user has typed:

Dim I As Long
Dim X As Long
X = Len(Combo1.Text)
For I = 0 To Combo1.ListCount - 1
    If Left$(Combo1.List(I), X) = Combo1.Text Then
        Combo1.Text = Combo1.List(I)
        Combo1.SeLStart = X
        Combo1.SelLength = Len(Combo1.Text)
        Exit For
    End If

And in the KeyDown event:

If KeyCode = vbKeyBack Then SkipChange = True

This is the same basic idea I use for an auto-complete combobox.

Accepted Solution

KDivad earned 400 total points
ID: 6343986
Forgot a part:

X = Len(Combo1.Text)
If SkipChange Then Exit Sub
For I = 0 To Combo1.ListCount - 1

Expert Comment

ID: 6343987
One more time:

X = Len(Combo1.Text)
If SkipChange Then
    SkipCahnge = False
    Exit Sub
End If
For I = 0 To Combo1.ListCount - 1
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Expert Comment

ID: 6343990
You've got to be getting tired of this. <sigh>

SkipCahnge = False

should be:

SkipChange = True
LVL 43

Expert Comment

ID: 6344401
Do you have the ComboSearch property set to flexCmbSearchAll ? I think that if you choose one of the other settings it affects the way the searching works.
LVL 49

Expert Comment

ID: 7198390
Hi sudarshan_shir,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept KDivad's comment(s) as an answer.

sudarshan_shir, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
DanRollins -- EE database cleanup volunteer

Expert Comment

ID: 7213213
Per recommendation, force-accepted.

CS Moderator

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question