Presenter:Beth Massi
Visual Basic programmers will see how to set up data binding to achieve one-to-many filtering using a combobox which filters a grid. They will also see how to add a calculated column and how to format currency fields.
Click here to go to original video page
Minute 0
My name is Beth Massey and welcome to the Windows forms of a data video series in this next video I m going to demonstrate one to many filtering using a combo box and a grid in the last video we use the combo box as a lookup list this time we want to populate the combo box with a list of rows from our product table and filter the grade of orders so and Visual Studio open here we create a order manager application in the previous videos and work with any deal is for them to create a new form so I m going to right click on the project select add new Windows form emerges in a name at form five so the next thing we re going to do is connect directly Sunday to go to the data menu and show data sources them and add a new data set into our project and will select database and use the current connection string and I want to set up a forum that shows products in a
Minute 1
Combo box and filters of the order details integrated so that we can get a tally of what products are on order in our system some select order detail and product and I m in a nice products product orders is the next thing I m going to do is really going to toolbox and I am going to drop a combo box onto our form they were going to expand our product orders data set and you ll see order detail and product take a look at the product will see the order detail related underneath the products of this is what we want to work with here tracked the product onto the combo box initial setup inviting source in the component tray as well as set up our data biting mode properly on our combo box does for us meditate a description to an drag is
Minute 2
Over our description is multi line so we can expand this adds like multiline gay and I don t want at it in the product table saw midges quickly set the text box to read only and I m going to set the drop down style to drop down list on her combo box so I m going to drag the order detail onto the form here and reduced and edit the columns here and I m going to remove the order detail ID and the product ID down our price I want to display that as a currency format so many go to the default cell style that I m going to select the format in this cell style builder as currency
Minute 3
A next I m also going to set the acre property on our grade year so it looks a little bit better with just the form so the very last thing we need to do is we need to add some code so that when I select this throw in the combo box to the position in the products fighting source changes and that will give us the iMac filtering in the related order detail summit double click on the combo box and this will add our selected index change handler and I m just going to select a product binding sources position and said that equal to be combo boxes selected index the gasket is attached in a five annual seen as I scroll to the products here in select one the orders below filters great
Minute 4
So now we have our filter working when I wanted you is I want to tally up the totals on each of the order details still I want to add a column there and what would he do is double click on our product orders data set and will add a column by right clicking order details looking at column enamored in a college total integrated computer the property sheet and I m an editor at the expression is quantity time spice villages need to set the datatype to a double case of St okay now we re just going to add that column to our gig review here with this click add total and regular
Minute 5
Domi field and were also claimed to change the format here so that it shows as currency in tank and now I just want to summarize all the totals down the bottom here and we re just going to put a text box the bottom of the form like that and what you do is calculated totals each time the filter changes so are going to right click Unicode and what you do is returning to add a handler to the product binding sources position changed event ever also do this see the product binding sources current changed event so anytime a row changes or the position changes we want to run this cup salad to say it
Minute 6
Owns binding czars position me that there s some rose and are granted a if it s greater than minus one minute run this code otherwise we re just in a set the text box tax equal to the empty string case understated dim up a total variable here and emerges an essay for each row as the row view in the order details finding sources last the list is a data view so they rose at a data row views would disconnect tally this up the row struggles they still need a text box 1 txt and what is going to format this
Minute 7
As a currency and going to hit F5 and now we ll see that as we scroll through the records we are getting our total and our summary told down at the bottom as we reached so what we did was we set up a combo box as the one to many filter on our grade we also added a expression base column and calculated the summary of that total dump on our screen so I d like to thank you for your time if you like to check out the Visual Basic developer Center will be posting updates to these videos there please also check out the Visual Basic team blog and my blog for more information they figure
Sunday, May 25, 2008
Video: How Do I: Filter Data on the Client?
Labels:
client,
filter data
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment