473,396 Members | 1,797 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,396 software developers and data experts.

What's the point of Simple Data Binding?


Hello All,

In two different books, Simple Data Binding to a control is explained
with an example of a TextBox where the data is initialized with an
array.

For example a class is defined as such:

public class Vendor
{
private string vendorName;
public string VendorName
{
get
{
return vendorName;
}
set
{
vendorName = value;
}
}

public Vendor(string strVendorName)
{
VendorName = strVendorName;
}
}
}

A TextBox is placed on the main form Form1 with the following code:

public Vendor[] aVendors;

private void Form1_Load(object sender, System.EventArgs e)
{
this.aVendors = new Vendor[3];
aVendors[0] = new Vendor("Microsoft");
aVendors[1] = new Vendor("Praxis");
aVendors[2] = new Vendor("Rational");
txtVendor.DataBindings.Add("Text",aVendors,"Vendor Name");
}

where txtVendor is the name of the TextBox.

My question now is what else can you do with this? What's the point?
Is there some utilitarian advantage here that I am not seeing?

Neither of the texts expands on this. They both go into Complex Data
Binding which is a different animal. FYI,I am coming from the MFC VC++
world is that means anything.

Thanks,
Joe

I can also be reached at:
filter1_at_digitalchickenDOTnetNOSPAM
Jul 21 '05 #1
3 1442
Try adding a button to your form with this button handler.

private void button1_Click(object sender, System.EventArgs e)
{
BindingManagerBase bmb =
this.BindingContext[this.aVendors];
bmb.Position = (bmb.Position + 1) % bmb.Count;
}

Then imagine your vendor class has 50 public properties, and you want to
show 10 of them in labels or textboxes on a form so you can edit them. You
could then use the BindingManagerBase to move the 'current' vendor back and
forth. This effectively lets you page through all the vendor' properties
with just Next and Previous buttons.

==========================
Clay Burch, .NET MVP

Visit www.syncfusion.com for the coolest tools

"Jow Blow" <see_address@in_msg.com> wrote in message
news:eh********************************@4ax.com...

Hello All,

In two different books, Simple Data Binding to a control is explained
with an example of a TextBox where the data is initialized with an
array.

For example a class is defined as such:

public class Vendor
{
private string vendorName;
public string VendorName
{
get
{
return vendorName;
}
set
{
vendorName = value;
}
}

public Vendor(string strVendorName)
{
VendorName = strVendorName;
}
}
}

A TextBox is placed on the main form Form1 with the following code:

public Vendor[] aVendors;

private void Form1_Load(object sender, System.EventArgs e)
{
this.aVendors = new Vendor[3];
aVendors[0] = new Vendor("Microsoft");
aVendors[1] = new Vendor("Praxis");
aVendors[2] = new Vendor("Rational");
txtVendor.DataBindings.Add("Text",aVendors,"Vendor Name");
}

where txtVendor is the name of the TextBox.

My question now is what else can you do with this? What's the point?
Is there some utilitarian advantage here that I am not seeing?

Neither of the texts expands on this. They both go into Complex Data
Binding which is a different animal. FYI,I am coming from the MFC VC++
world is that means anything.

Thanks,
Joe

I can also be reached at:
filter1_at_digitalchickenDOTnetNOSPAM

Jul 21 '05 #2

Clay,

Thanks for your response.

I can see your point.

In VC++ MFC, one would use the DDX, the UpdateData() and so forth
function in order to pass data from variables to controls or vice
verse. The methodology in .NET doesn't seem to be as explicit... at
least it isn't to me.

I'm not seeing explicit ways to (as per the previous example):
pass data from the control back to sVendors once data in aVendors has
changed or the form is closing, AND
refresh the control(s) once the base data has changed.

Neither of the two books I have cite an example.

Also neither show where currencymanager is used explicitly. Both speak
of CurrencyManager in comments but show the Position property of
BingingContext being used. As far as I can tell from the .NET
documentation Position is being called from a BindingContext. I see no
example where CurrencyManager is being called and I dont see an
instance of it as a member of form classes or controlcontainers or
bindingcontexts. I must be missing something.

Thanks Clay...

Joe
On Thu, 8 Jan 2004 04:55:27 -0500, "ClayB [Syncfusion]" wrote:
Try adding a button to your form with this button handler.

private void button1_Click(object sender, System.EventArgs e)
{
BindingManagerBase bmb =
this.BindingContext[this.aVendors];
bmb.Position = (bmb.Position + 1) % bmb.Count;
}

Then imagine your vendor class has 50 public properties, and you want to
show 10 of them in labels or textboxes on a form so you can edit them. You
could then use the BindingManagerBase to move the 'current' vendor back and
forth. This effectively lets you page through all the vendor' properties
with just Next and Previous buttons.

==========================
Clay Burch, .NET MVP

Visit www.syncfusion.com for the coolest tools


Jul 21 '05 #3
On Fri, 09 Jan 2004 18:31:12 GMT, Jow Blow <see_address@in_msg.com>
wrote:
I'm not seeing explicit ways to (as per the previous example):
pass data from the control back to sVendors once data in aVendors has
changed or the form is closing, AND
refresh the control(s) once the base data has changed.

CORRECTION. That should be aVendors and not sVendors.

Joe
Jul 21 '05 #4

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

Similar topics

16
by: Jason | last post by:
Hey, I'm an experience programmer but new to Python. I'm doing a simple implementation of a field morphing techinique due to Beier and Neely (1992) and I have the simple case working in Python...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
12
by: Steven T. Hatton | last post by:
This is something I've been looking at because it is central to a currently broken part of the KDevelop new application wizard. I'm not complaining about it being broken, It's a CVS images. ...
0
by: Ian | last post by:
I have sub-classed the Page class in order to provide some base properties and methods that every page on my site will need access to. I would like to have these things show up in the Simple...
1
by: Anders S. Willumsen | last post by:
Hi, I'm implementing a 3-tier app (a shop) for the first time, and would like to have some of you guys comment on the design. Hope you can help me get rid of some confusion. I have a...
3
by: Jow Blow | last post by:
Hello All, In two different books, Simple Data Binding to a control is explained with an example of a TextBox where the data is initialized with an array. For example a class is defined as...
6
by: rn5a | last post by:
The different Page events in the page life cycle like Page_PreInit, Page_Init, Page_Load etc. - are they different stages of the runtime process? Does a server send back the HTML output of an...
184
by: jim | last post by:
In a thread about wrapping .Net applications using Thinstall and Xenocode, it was pointed out that there may be better programming languages/IDEs to use for the purpose of creating standalone,...
0
by: Chris Jobson | last post by:
>I have a sample similar to a previous post where I was binding a line end Not sure if I'm right, but I think the problem is that the data binding doesn't go through the property wrapper, but...
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:
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.