how add default values to new item in binding source

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top