472,783 Members | 918 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,783 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 2229

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: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.