Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I saw a vb application where text boxes were used for data entry forms. In every text box (on particular key press) a lookup form was opening for selection(in fact for search + selection).
Is it a good idea( lookup form)??.
Should i try to implement it in my C# data entry project?
is there any example or reference material about the right method to do it.
Posted
Comments
CHill60 14-May-14 17:38pm    
without any context it's difficult to answer a question like this. If it is something like an address, you will frequently see either a Button or an ellipsis next to a box with "find address" ... so you can put in a postcode/zipcode and have the rest of the address auto-completed. It really does depend on what sort of data you are having to enter.
I don't know of any generic reference material, but if you give a context (e.g. the *sort* of data you want to enter) then we may be able to help you more

1 solution

Is it a good idea? Only your customers can tell you that!

I have implemented similar things in the past - generally for reasonably large collections where users usually knew a code or number, and so would just type it in, but occasionally needed to look up the value.

For small collections, we used combos as they are far less distracting.

It's relatively easy - but needs a little thought up front; Are all of your look ups able to use a generic form? Will the returned value from the look up be an (ADO?) object or just a key - or a string to put in the text box.

The way I implemented the last one in WinForms was to create our own LookUpTextBox based on a plain vanilla text box, which had additional properties used to describe to the lookUp window what information was being looked up.

This LookUpTextBox detected a function key press, and then instantiated a LookUpForm with the appropriate parameters, showed the form modally, retrieved the result (our result was an integer ID and a String), place the string in the Text and store the ID which could them be used internally to identify the record selected.

One thing we did find was that the users constantly wanted additional functionality in the pop up windows - extra filtering for this entity, more information for that entity - and we ended up creating specific forms for many of the look ups.
 
Share this answer
 
Comments
Member 10637065 15-May-14 8:12am    
two methods i can think of for implementing look up forms.
1. Passing binding sources used in parent forms as public properties to look up forms.(Not ideal for concurrent data).
2. Fetch data(strings,integers,dates) in look up forms find id then find the relative data in main form.(It will require many round trips to database).
But i guess, i can think of situations where to use which.
Other thing is whether grid view will be too heavy for look up forms( few tables will have more than few thousand records), which built in control(vs 2010) you recommend( since i am a newbie and never used a custom control).
_Maxxx_ 15-May-14 17:23pm    
I"m not sure why you are talking about finding data in the main form/binding to the main form.
Does the main form already have a collection of all Customers (or whatever)?
Assuming you have some sort of DAL then I would make the look up forms stand-alone. The user enters the filtering data, the form gets the dataset from the database.
When the user selects one in the lookup form, it closes and the main form accesses the selected data and does whatever it needs to with it.
If Db speed is a real issue, then you can always cache the complete record sets in your DAL and provide filtering method(s) there to return only the appropriate records.
If you are talking about pretty static data (i.e. it won't change during program execution) then caching is a good idea - why continually go to the db to get the same list of customer types, for example)
One the controls front, I haven't programmed in winforms for a while, so can't make sensible comment, other than to suggest you develop using sub-classed vanilla controls (i.e. myGridView that just inherits from GridView). This may allow you to replace the base control with another, should performance be an issue, without too many changes.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900