Databinding with Windows Forms?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I'm fairly familiar with the databinding model for ASP.NET, but now I'm
trying to do the same with a C# windows forms application. I'm noticing
several differences: Firstly, there never seems to be a call to the
databind() method. What's the reason for this? Second, when looking at the
windows forms generated code for when using a dataset in conjunction with a
dataadapter, rather than use the Fill() method, it seems that the
SelectCommand property is set and yet again, magically, this seems to be
called. Am I correct? Why don't I see the datareader object listed under the
controls section of the toolbox? How can I bind to a simple textbox? Does
anyone have any good reading on databinding with Windows Forms? What would be
even better is literature comparing how it is done compared to web
applications. Thanks for any help...

-Ben
 
Hello Ben,

It is indeed different that we don't need to call databind() method in
winform. Winform control will do same thing automatically. And you can
still bind a TextBox to a dataset, when you need to move to the next
record, use code like:

CurrencyManager cm;
cm=(CurrencyManager)this.BindingContext[ds.Tables["Cust"]];
cm.Position +=1;

hope this help,

Luke
 
Back
Top