how add default values to new item in binding source

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

Guest

Using vs2005 and visual basic for a winform app: I have a form with a
sqlserver datasource, tableadapter, bindingsource and bindingsource
navigator. The column values are displayed in textboxes on the form. One of
the textboxes is read only to the user. Wnen the user clicks the add new on
the navigator I would like to use code to add a default value to the read
only column . How do I do this.

I have tried to put code in the "BindingNavigatorAddNewItem_Click" procedure
e.g. mytextbox.text = "default value"
but this doesn't work ... maybe it runs befor the new item is added by the
generated code?

All help appreciated
 
Well I guess I figured it out something like this

Mybindingsource.current.item(“columnnameâ€) = “whateverâ€
Or
Mybindingsource.item(indexnumber).item(“columnnmeâ€) = “andsoonâ€

But don't try just adding this to sub that is associated with the default
'Add' button on the bindingnavigator strip
 
Back
Top