473,586 Members | 2,754 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(obje ct sender, System.EventArg s e)
{
this.aVendors = new Vendor[3];
aVendors[0] = new Vendor("Microso ft");
aVendors[1] = new Vendor("Praxis" );
aVendors[2] = new Vendor("Rationa l");
txtVendor.DataB indings.Add("Te xt",aVendors,"V endorName");
}

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_digi talchickenDOTne tNOSPAM
Jul 21 '05 #1
3 1461
Try adding a button to your form with this button handler.

private void button1_Click(o bject sender, System.EventArg s e)
{
BindingManagerB ase bmb =
this.BindingCon text[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 BindingManagerB ase 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.c om...

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(obje ct sender, System.EventArg s e)
{
this.aVendors = new Vendor[3];
aVendors[0] = new Vendor("Microso ft");
aVendors[1] = new Vendor("Praxis" );
aVendors[2] = new Vendor("Rationa l");
txtVendor.DataB indings.Add("Te xt",aVendors,"V endorName");
}

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_digi talchickenDOTne tNOSPAM

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 controlcontaine rs 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(o bject sender, System.EventArg s e)
{
BindingManagerB ase bmb =
this.BindingCo ntext[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 BindingManagerB ase 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
2574
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 2.3 - but it's REALLY slow. Basically, you specify two directed line segments in the coordinate system of a raster image and use the difference...
125
14640
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 software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
12
3284
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. Such things happen. The whole subsystem is going through radical changes. I don't really want to say what I think of the code just yet. That would...
0
1445
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 Binding window of the DataBindings dialog. I then found this site...
1
1141
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 data-tier, business-tier and GUI In the data-tier I have all my data code - connection to SQL Server, and getting and pushing data. One methods could be...
3
291
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 such: public class Vendor {
6
1801
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 ASPX page to the browser immediately after the runtime or are there any processes involved in between the runtime & the time when the server sends the...
184
6955
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, single executable apps. My goal is to create desktop applications for use on Windows XP+ OSs that are distributed as single executables that do not...
0
1128
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 just calls SetValue directly - so you're never actually changing Points. The solution is to use a PropertyChangedCallback: public static readonly...
0
7911
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8338
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7954
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8215
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3836
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1448
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1179
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.