Username: Save?
Password:
Home Forum Links Search Login Register*
    News: Keep The TechnoWorldInc.com Community Clean: Read Guidelines Here.
Recent Updates
[October 17, 2024, 05:05:06 PM]

[October 17, 2024, 04:53:18 PM]

[October 17, 2024, 04:53:18 PM]

[October 17, 2024, 04:53:18 PM]

[October 17, 2024, 04:53:18 PM]

[September 09, 2024, 12:27:25 PM]

[September 09, 2024, 12:27:25 PM]

[September 09, 2024, 12:27:25 PM]

[September 09, 2024, 12:27:25 PM]

[August 10, 2024, 12:34:30 PM]

[August 10, 2024, 12:34:30 PM]

[August 10, 2024, 12:34:30 PM]

[August 10, 2024, 12:34:30 PM]
Subscriptions
Get Latest Tech Updates For Free!
Resources
   Travelikers
   Funistan
   PrettyGalz
   Techlap
   FreeThemes
   Videsta
   Glamistan
   BachatMela
   GlamGalz
   Techzug
   Vidsage
   Funzug
   WorldHostInc
   Funfani
   FilmyMama
   Uploaded.Tech
   MegaPixelShop
   Netens
   Funotic
   FreeJobsInc
   FilesPark
Participate in the fastest growing Technical Encyclopedia! This website is 100% Free. Please register or login using the login box above if you have already registered. You will need to be logged in to reply, make new topics and to access all the areas. Registration is free! Click Here To Register.
+ Techno World Inc - The Best Technical Encyclopedia Online! » Forum » THE TECHNO CLUB [ TECHNOWORLDINC.COM ] » Techno Articles » Internet
 Data Binding in TierDeveloper
Pages: [1]   Go Down
  Print  
Author Topic: Data Binding in TierDeveloper  (Read 536 times)
Shawn Tracer
TWI Hero
**********


Karma: 2
Offline Offline

Posts: 16072


View Profile
Data Binding in TierDeveloper
« Posted: February 25, 2008, 12:01:00 PM »


Data Binding in TierDeveloper
 by: Ann Morris

INTRODUCTION

One of the most powerful aspects of .NET and Windows Forms is data binding. Data binding is the process of associating user interface (UI) elements with a data source to generate a visual representation of data. Two types of data binding are available for Windows Forms: Simple Data Binding and Complex Data Binding.

Simple data binding allows you to bind one data element to a control. In many situations you want to display only one record at a time e.g., customer’s personal information. Textboxes and labels are such controls that are used for this purpose and hence called simple binding.

Complex data binding allows you to bind more than one data element to a control. For example if you want to display number of orders placed by a customer you would use controls like data grid controls, list boxes.

The data binding capabilities of .NET are similar to ADO and the Visual Basic controls. Visual Basic or Delphi users will find .NET data binding more flexible and more transparent. It saves a lot of time in both Windows Forms and ASP.NET applications.

How to Bind TierDeveloper DataSet to Data Grid Control

Assumptions

   1. You are using TierDeveloper’s sample project “TDevStoreSQL.tier” and you’ve defined a query method “GetAllCustomers” for the object “Customers”.
   2. You have generated the components and Windows Forms Application from TierDeveloper.
   3. You have access to a database, such as Microsoft SQL Server™ or Microsoft Access.

In order to bind Data Grid please follow these steps: -

1. Open the TierDeveloper generated project in VS.NET

2. Add and open a new Windows Form.

3. Select the ToolBox window and click on Windows Forms tab.

4. Drag DataGrid component and place it anywhere on the Windows Form.

5. Paste the following code in the Windows Form Load event.

[Visual Basic]

Private Sub CustomersForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

   Dim cf As CustomersFactory = New CustomersFactory
   DataGrid1.CaptionText = "Customers"
   DataGrid1.DataSource = cf.GetAllCustomersDS()

End Sub

[C#]

Private void CustomersForm_Load(object sender, System.EventArgs e)
{   
   
   CustomersFactory cf = New CustomersFactory();
   DataGrid1.CaptionText = "Customers" ;
   DataGrid1.DataSource = cf.GetAllCustomersDS();

}

6. The postfix DS shows that this method will return a DataSet object.

7. Run the application and you will see that the DataGrid is filled with all the customers.

Note: You can also bind datagrid to customer collection to do this you will just have to change the grid data source to the method that can return collection.

DataGrid1.DataSource = cf.GetAllCustomers();

About The Author

I am Ann Morris and work in Software development consultancy company.
[email protected]

Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Copyright © 2006-2023 TechnoWorldInc.com. All Rights Reserved. Privacy Policy | Disclaimer
Page created in 0.072 seconds with 24 queries.