473,395 Members | 1,537 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Data Binding ....... and how is used in .Net Application i.e, TierDeveloper?

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

• You are using TierDeveloper's sample project "TDevStoreSQL.tier" and
you've defined a query method "GetAllCustomers" for the object
"Customers".
• You have generated the components and Windows Forms Application from
TierDeveloper.
• 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();
Jul 21 '05 #1
0 2303

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For...
0
by: momina_dar | last post by:
AlachiSoft “TierDeveloper” eradicates the problem of writing thousands of lines of code for your middle tier. Many software solutions on the market can do it for you but according to our research...
0
by: Wesman | last post by:
Why does the following code not work (displays the correct values in the second textbox). if i chane the OnFocusChange method to the following it will work: private void OnFocusChange(object...
0
by: Wesman | last post by:
Why does the following code not work (displays the correct values in the second textbox). if i chane the OnFocusChange method to the following it will work: private void OnFocusChange(object...
0
by: annie | last post by:
Simplify your .NET development with TierDeveloper. TierDeveloper lets you map your .NET business components against your relational databases, embed complex SQL in them along with your business...
1
by: Patrick | last post by:
Hi all, New to .NET, I'm working on an Winforms client application using VS 2005 beta2. My needs considering data storage are the followings: (1) Small files (0 < length < 10 mb), containing...
0
by: Ann Morris | last post by:
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...
0
by: mjsterz | last post by:
I've been working with VB .NET for less than a year and this is the first time I've posted on one of these groups, so let me apologize beforehand if I'm being unclear, not posting my issue...
6
by: Wesley Peace | last post by:
I hate to cross post, but I've gotten no answer yet on a problem I'm having with visual studio 2008. I've created a series of forms with controls to access a Access database tables. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.