Google Search

Google
 

Sunday, May 25, 2008

Video: How Do I: Use the DataRepeater Control?

Presenter:Beth Massi

Visual Basic Developers will learn how to work with the new DataRepeater found in the latest version on the Visual Basic Power Packs. The DataRepeater is more flexible than a grid and displays a scrollable container of any Windows Forms controls you place inside it for each row of your data.





Click here to go to original video page


Minute 0

I need a nasty name to show you how to use the new data repeater control that you can find in the Visual Basic power pack 3 0 release the data repeater control is a control that you can use to display rows of your data in a scrollable container and inside the complaints other Windows forms controls said that the power packs you can go to downloads tab from the Visual Basic developer Center and you can see it inside the download speed once you install this missile install new controls underneath Visual Basic power pack in your toolbox in Visual Studio let s take a look at how we can build an application using this new data repeater control so Visual Studio open hearing what I create a new Windows forms applications on your project select Windows forms recall this e zine data repeater control
Minute 1

Click okay okay so they take a look in our toolbox to see and you have here told Visual Basic power pack sludge and soul power packs annual notice that David peters down here s on its drag is on tour form any idea is that we drag other controls under Windows forms controls onto this design surface insight here and did her Peter will create a scrollable area for each row of our data it ll re create those controls case if you use Visual Basic six before this look familiar so many go ahead and connect to a database and this can use Northwind select add a new data source and a database and there s Northwind and it is going to select and our employees table pain on this call this employee status at the finish
Minute 2

Learned that s just a guess and data to take a look at how this works okay so I m going to make the form is that the former little bit bigger here and let s go ahead and make this figure and set the anchor can also set the dock companies at the anchor Katie Miguel called up a self well it is honestly drag a few items and heroin acts he dragged the photo is on a dragnet is a picture and pay an indefinite use the label is at the photo right up here to the war square tank and I m also that put the last name and the first name case and it is I m just creating some Windows forms controls and this is one row instance of data and you can make it as big as you want secret that is my stuff and hears you why there s a couple different layouts that you can use a dictator appear itself was just a note
Minute 3

Here to pay and do I ll make this multiline can he make a little bit bigger We can make this Phyllis up space a great self as a couple options in the data repeat are here click on the repeater itself the whole thing to use the smart tag you can go ahead and select the layout style you can actually lay out vertically like I have it here or horizontally if you want case of that its goals haulers on to me and said of its been a scroll vertically so let s just see how was looks right now before I do them in a set the picture size mode equal to stretch image so it fits into this box exactly I want with access to stick around and you can see how this looks okay so there you go for each employee can see
Minute 4

You have a row of data it s actually rendering these controls exactly how I laid them out a case that s at the data repeater control does for you needed still get at the binding source position abiding source is still being used here and each one of these data repeater items you can actually drawing yourself if you want to paint a background differently or you might do something different like that okay so let s take a look at how you do that select say what I wanted you is that when all take the colors of the backgrounds each of these rows case to what we can do is we can just double click on here to get to the code behind and they can handle the event on the data repeater call draw item here is okay so let me just get this ways we can see code day and what if a parameter series being passed the event arts here is called a data repeater item event our skin that gives us access to the data repeater item
Minute 5

At surrendering a relevance that display never is data a day so I does it say if EDI data repeater item bomb item index on two equals zero days with even one eat a repeater back color and will make the back color white differences can otherwise will make the gator appeared back color I a item back color or equal to I like Alice blue but might shush up on video so let s do cyan or any with go ahead run as this is a lousy discussing draw anything you want a great finale bout late and cyan alternating a taste of the gator gear and disease in a flexibility that you may need to go ahead and drop items as well
Minute 6

Old is and what a show how the data can be accessed to pay on the rows can be accessed and it basically exact same way we always access the data on you can set to ahead and select me binding source concert in this case if the employees binding source and can see the position change and basically what I want to demonstrate his want to show you that the position change in the binding source also fires even if the data repeater is now being used in tanks as like a grade of D is now a fire to position change the buying source because restoring onto different rows of our data a caisson is to put a breakpoint here and on around us again and as we screw select different rows of our data and Through all the controls proceeded to sing fires any self ahead and run us once more in as the fire s first case of the head and is okay very and now as you ve see what can they go into this route and I m going to just tab through an
Minute 7

Just as I happened to go the next rows in fires again so the position is changed meaning there s a new row in there now are in this route okay so if I go back to this growth the click of a mouse there is fired again okay this allows you to get at the position of the day role that s been displayed so is a snippet for that is probably use this in many videos before if you right click an insert snippet gets underneath the data and designer features and you can select convert binding source connect to a specific row in the data table a tank so basically what I m contiguous to employees at its employee data set yet employee row employees row and he and an abiding source is called employees binding source tag great day so that it lets you get access to the Rocinante zero address here all the
Minute 8

Common properties here on this data route okay so let s go ahead and just employee this crappy employee ID so we can just go ahead and say debug write line play ID UK rights of the day to repeat her acts exactly the same as any list control so you can be assured that you ll get calm the same sort of behavior for all of your controls on your form okay so have fun play with the data repeater they can see the employee IDs I selected I hope you enjoy this power packs and hope they really are speeding up the development process for you as you build your net Windows forms applications awesome so I d like to thank you for your time if you d 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 basic and

No comments: