all groups > dotnet windows forms > june 2007 >
You're in the

dotnet windows forms

group:

how add default values to new item in binding source


how add default values to new item in binding source Paul Emery
6/28/2007 5:54:01 PM
dotnet windows forms: 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

--
Paul Emery
Data Base and Ecommerce Consultant
RE: how add default values to new item in binding source Paul Emery
7/1/2007 5:08:01 PM
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
--
Paul Emery
Data Base and Ecommerce Consultant
Michigan


[quoted text, click to view]
AddThis Social Bookmark Button