Thanks Andrew for pointing me in the right direction.
Main Topics
Browse All TopicsHi, I am completely new to VFP and have been asked to look at some code that was written years ago and try to add drop down search capability. In this case it will be when a user starts typing in the product #, a box appears below the entry that lists all of the products that begin with the first entry, then narrow accordingly as the user types additional digits. I have included a .jpg of another application to show what I mean.
I know practically nothing about VFP 6 so the more detailed you could be the more helpful.
Thanks in advance for any help that is given.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Andrew,
I have figured out where the code is and played around with a combobox in the visual designer. It currently looks like a text box is prompting for a product #, then they do a direct lookup on that product # and display the product # info. Below is the code. Does this look like something that can be easily changed to a combobox or should I try from scratch?
Thanks,
Charlie
Set Exact on
WkProdId = UPPER(Alltrim(thisform.txt
WkLabelName = "Unknown"
If Len(WkProdId) < 1
Thisform.imgCSALogo.Visibl
Thisform.txtSize.value = ""
Thisform.txtComponent1.val
Thisform.txtComp1_Mat.valu
Thisform.txtComponent2.val
Thisform.txtComp2_Mat.valu
Thisform.txtComponent3.val
Thisform.txtComp3_Mat.valu
Thisform.txtMax_Wgt.value = ""
Thisform.txtMax_Force.valu
Thisform.txtMax_elongate.v
Thisform.txtMax_Fall.value
Thisform.txtMin_Break.valu
Thisform.txtCSA_Class.valu
Thisform.txtProd_desc.valu
Thisform.txtGeneralMsg.val
WkLabelName = ""
Thisform.txtD_Ring.value = ""
Thisform.txtLabel_Fmt.valu
Thisform.txtCSA_Std.value = ""
Thisform.txtCSA_Logo.value
Thisform.txtANSI_Std.value
Thisform.txtOSHA_Std.value
**
cMessageTitle = '* * * * * * * * * * * Safewaze Labeling * * * * * * * * * * *'
cMessageText = ' Blank Product Number...Do you want to EXIT?'
nDialogType = 4 + 32 + 0
* 4 = Yes and No buttons
* 32 = Question mark icon
* 0 = First button is default
nAnswer = MESSAGEBOX(cMessageText, nDialogType, cMessageTitle)
If nAnswer = 6 && 7 = they pressed No button (The Yes button is 6)
Clear EVENTS
Close ALL
Thisform.Release
Return
Endif
Return
Endif
Use M:\Easy32\data\sw_prod.dbf
Set ORDER TO TAG prod_id OF M:\Easy32\data\sw_prod.cdx
Go Top
NoProductFound = "N"
Seek(WkProdId) IN sw_prod
If NOT Found()
Use
Use M:\Easy32\data\sw_prod.dbf
Set ORDER TO TAG prod_id_2 OF M:\Easy32\data\sw_prod.cdx
Go Top
Seek(WkProdId) IN sw_prod
If NOT Found()
NoProductFound = "Y"
ENDIF
Endif
If NoProductFound = "Y"
Thisform.imgCSALogo.Visibl
Thisform.txtSize.value = ""
Thisform.txtComponent1.val
Thisform.txtComp1_Mat.valu
Thisform.txtComponent2.val
Thisform.txtComp2_Mat.valu
Thisform.txtComponent3.val
Thisform.txtComp3_Mat.valu
Thisform.txtMax_Wgt.value = ""
Thisform.txtMax_Force.valu
Thisform.txtMax_elongate.v
Thisform.txtMax_Fall.value
Thisform.txtMin_Break.valu
Thisform.txtCSA_Class.valu
Thisform.txtProd_desc.valu
WkLabelName = ""
Thisform.txtD_Ring.value = ""
Thisform.txtLabel_Fmt.valu
Thisform.txtCSA_Logo.value
Thisform.txtCSA_Std.value = ""
Thisform.txtANSI_Std.value
Thisform.txtOSHA_Std.value
**
Thisform.txtGeneralMsg.val
cMessageTitle = '- - E R R O R - -'
cMessageText = 'Product Number not found on file...'
nDialogType = 0 + 64 + 0
nAnswer = MESSAGEBOX(cMessageText, nDialogType, cMessageTitle)
Thisform.txtGeneralMsg.val
Return
Endif
* 06/15/2009 Added below to show CSA logo based on new SAP Classification field CAF
If sw_prod.csa_logo = "Y"
Thisform.txtCSA_Logo.value
Thisform.ImgCSALogo.Visibl
Else
Thisform.txtCSA_Logo.value
Thisform.ImgCSALogo.Visibl
Endif
* 06/15/2009 End CAF
Thisform.txtGeneralMsg.val
Thisform.txtSize.value = sw_prod.size
Thisform.txtComponent1.val
Thisform.txtComp1_Mat.valu
Thisform.txtComponent2.val
Thisform.txtComp2_Mat.valu
Thisform.txtComponent3.val
Thisform.txtComp3_Mat.valu
Thisform.txtMax_Wgt.value = sw_prod.Max_Wgt
Thisform.txtMax_Force.valu
Thisform.txtMax_elongate.v
Thisform.txtMax_Fall.value
Thisform.txtMin_Break.valu
Thisform.txtCSA_Class.valu
Thisform.txtProd_desc.valu
WkLabelName = sw_prod.label_fmt
Thisform.txtLabel_Fmt.valu
Thisform.txtD_Ring.value = sw_prod.d_ring
Thisform.txtCSA_Std.value = sw_prod.csa_std
Thisform.txtANSI_Std.value
Thisform.txtOSHA_Std.value
Use
You will likely be better off going from scratch - mostly because of the rowsource and rowsourcetype properties that are required in the combobox and not present in the text box example. Certainly the code that you have attached will provide some pointers!
I have a class that I spent quite a bit of time on in the past that I will try to dig up a little later and pass along to you for your use and/or study. It does more of what you are after...
Thanks for the grading Charlie!
Andrew
Hi Andrew,
That would be great if you would pass on the training materials. I would really appreciate it.
I have another question:
I got a combobox to work using the builder just to see how it would behave and as you said, it is not exactly as the users requested and it does not appear like it would work for us. Is there a way with coding that it could work exactly as I had hoped?
Another thought - what about a textbox as it stands now but with a pop-up list via a key-press, that could pass the selection to the text field?
Thanks,
Charlie
Business Accounts
Answer for Membership
by: AndrewJenPosted on 2009-10-14 at 11:37:52ID: 25573613
The control that you want is a Combobox in VFP-speak.
Set the IncrementalSearch property to .t. (true).
The above will partially satisfy your request by positioning the cursor on the item that most closely matches the typed characters.
To narrow the contents of the dropdown requires more code...