Customer Form with Lookup and 3 Tabs

ReportsNerd

Active member
Joined
Nov 24, 2012
Messages
31
Programming Experience
3-5
Hi Forum,

I have a windows form with 3 tabs on a tab control and a text box sitting outside the tab control section. I need each tab to have text boxes with different info pulled about the customer in an Access database. So each tab will use a different query about the customer. Sitting outside the tab control, I have a text box with the customers name on the form. I need to feed that customer text box with another form that just does a customer lookup or perhaps I can do it on the same form.

The real trick is being able to persist the customer data as the user moves from tab to tab. I'm thinking I need to run all the tabs queries at one time when I perform the customer lookup outside the tab control.

Suggestions/Examples appreciated.

Thanks
 
You're making this much harder than it has to be. Just do one query to get all the data and populate the controls on all three pages. The form will retain a reference to the original data so there's no issue persisting. Any changes made on any page are pushed back to that one object. When you're done, save the contents of that one object back to the database.
 
I see where you are going with this. That should work, but let me explain a little more detail. The first tab has some text boxes about the customer and a couple combo box lookups. This first tab is where new customers are entered and then the information can be viewed later on that same form after customer lookup. The second tab takes all the info you entered in the first tab and displays some 20 text boxes of calculations. The thrid tab will have a data grid with all the transaction history of the customer.

I guess what I'm trying to ask here is if there is a good resource out there for reading and writing data with forms. I have seen the video examples out there that let you use Visual Studio 2010's drag a dataset out to your form and it automatically creates a read/write form, but I obviously need more control and customization than that.

Help appreciated
Thanks
 
OK, that's a bit more complex but it's still not a big deal. You would still use a single object to store all the data for all the pages. That object can be as complex as you like so it can contain a hierarchy of data or whatever you like. For instance, it might be a class of your own definition with three properties: one for each page. Each of those properties type might also be a class of your own definition and they might have properties for each of the controls on the corresponding page. For the grid, you might have a property whose type was a collection or perhaps DataTable.

You might then have two Boolean variables to represent whether the second and third pages had been viewed. On the SelectedIndexChanged event of the TabControl, you could test the appropriate flag and, if the selected page had not been viewed, perform the appropriate tasks to populate the data that corresponds to that page.
 
Thanks for your suggestions on this, that makes sense. I will need to start with a modal customer search dialog that will pop-up when I hit the seek button laying outside the tab control. Are there any examples on how do to this? Basically, I need a popup window with a text box I can type in some text for the seek value (like a last name) , and then when I hit the OK button, it runs the select query and populates the first page of my tab with the customer info. I have the code examples for select, insert and delete of my form data, but having problems finding a good example of a separate pop-up form to provide the select query value.

Examples/Suggestions appreciated.
 
The separate form doesn't provide the SELECT query. The separate form simply provides a value to assign to a parameter of your SELECT query. All the rest is done in the main form. You simply add a property to the dialogue form that returns the data entered by the user. The main form displays the dialogue and, if the user clicks OK, gets that property value from the dialogue and uses it in the query.
 
Back
Top