Data Binding Windows Controls

  • Thread starter Thread starter Pranav Shah
  • Start date Start date
P

Pranav Shah

I have series of textboxes that I want to bind to a
dataset. I have a search box. When the user enters a
value to serach I call a Stored Procedure to populate the
dataset. This work however only for the first serach.
After that it does not show the values for other
searches. I need some help on how this should be
implemented.
Thanks,
Pranav
 
You'll probably want to pull the data over in one step depending on teh
number of records. The BindingManagerBase/BindingContext can get this done
for you quite easily. It would help though if you could post the tables you
are using and the code. There are a lot of ways to accomplish what you
want, so a 'good' solution really depends on your underlying structure.
 
Private Variables:
private DataSet dsProduct = new DataSet();

On Load, BindControls
txtBrand.DataBindings.Add("Text", dsProduct, "Basic.Brand");
txtStock.DataBindings.Add("Text", dsProduct, "Basic.Stock_Qty");

When user clicks on The Find Button:
dsProduct = Product.Get_ProductData_Basic(txtBarcode.Text);

But this only works for the first search.
After that the txtBrand and txtStock values do not update.

I see the updated value in the DataSet(dsProduct), but the values do not
show up in the textboxes.
 
myCurrencyManager = (CurrencyManager)this.BindingContext[dsProduct];
myCurrencyManager.Refresh();

Does this help (I havent used this, just read the docs & interpreting it my way) ?

Kalpesh
 
Back
Top