Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Question concerning Incremental Search - Like Help Index faq184-3842

Question concerning Incremental Search - Like Help Index faq184-3842

Question concerning Incremental Search - Like Help Index faq184-3842

I tried that code (written by craigsboyd) and it works fine.
Now I wanted to have this code as an additional feature in a form which I created myself.
But I have problems to integrate that, when I implement a click-button on my form which has the code written by craigsboyd in its click-event.
VPF then says :
"Methods and events cannot contain nested procedures or class defintions"

I am sorry that I am not experienced with classes - but perhaps anyone here could help with a solution to add this useful code by craigsboyd to a form which already exists.

Thanks in advance.
Keep healthy...

See FAQ184-3842: Incremental Search - Like Help Index

Peace worldwide - it starts here...

RE: Question concerning Incremental Search - Like Help Index faq184-3842

Hi Klaus,

whenever you edit a method or event in the visual designer, you have to imagine your code written within PROCEDURE method/eventname() and ENDPROC. You can't embed further methods/events within a method/event. This kind of nesting code is not allowed. Even less so a whole class definition with objects and object methods.

The essential code you need from the FAQ is the interactivechange event code for the listbox and textbox. So you have to pick out the code in the interactivechange events and put them into your visual controls interactivechange vents.

On the other side look into the autocomplete feature of a VFP9 textbox, which gives you alternative options by just setting a few properties and having the data the user should be able to incrementally search in a table with a certain structure. Can't tell you from the top of my head, but simply lookup autocomplete in VFP's help.


RE: Question concerning Incremental Search - Like Help Index faq184-3842

The code in the FAQ is completely self-contained. It creates a form, adds a listbox and textbox, and then adds the incremental search functionality.

What you are trying to do is to incorporate that code into an existing form. That's not going to work. Instead of simply copying the code, you should try to understand what it is doing and how it works, and then use those same ideas (not necessarily the same code) in your own application.

That said, there are easier ways of implementing incremental search. My preference would be to use a textbox with its AutoComplete property set to 1 (as suggested by Chris above).

Or, for a simpler implementation, just set the listbox's IncrementalSearch to .T. It's not as flexible as the other methods, but much easier to implement.


Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Question concerning Incremental Search - Like Help Index faq184-3842

Thank you very much, Chris & Mike.
Your suggestions will help me very much.

Greetings from Western-Germany


Peace worldwide - it starts here...

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close