|
Creating a Binding Navigator |
|
There are various ways you can create a binding navigator:
- You can declare
a variable of type BindingNavigator and configure it
- From the Data section of the Toolbox, you can drag a BindingNavigator
object and drop it on a form. You should then access the Properties window
for the binding navigator. To support this, the BindingNavigator class has a
property named BindingSource. You can access it from the Properties window
of the binding navigator and select the binding source
- If you drag a table from the Data Source window and drop it on a form,
Microsoft Visual Studio would create and configure a binding navigator for
you
|
Practical Learning: Creating a Binding Navigator
|
|
- In the Data section of the Toolbox, click BindingNavigator and click the
form
- In the Properties window, change its Name to bnRentalProperties
- Still in the Properties window, click BindingSource and select
bsSolasPropertyRental
- In the Data section of the Toolbox, click DataGridView and click the
form
- Still in the Properties window, click DataSource and select
bsSolasPropertyRental
- Under the Properties window, click Edit Columns and configure the
columns as follows:
| Column |
HeaderText |
Width |
| RentalPropertyID |
Prop ID |
50 |
| PropertyCode |
Prop Code |
70 |
| PropertyType |
Property Type |
90 |
| Bedrooms |
Beds |
50 |
| Bathrooms |
Baths |
50 |
| MonthlyRent |
Monthly Rent |
80 |
| OccupancyStatus |
Status |
90 |
- In the Properties window, change the following characteristics:
(Name): dgvRentalProperties
ColumnHeadersHeightSizeMode: EnableResizing

- Execute the application to see the result

- Close the form and return to your programming environment
|
|