Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vb.net 2008 Datagridview - DataGridView1.UserAddedRow trigger issue

Status
Not open for further replies.

rw409168

Programmer
Jul 16, 2009
95
GB
Greetings,

Im fighting with my sanity over datgridviews again.

My datagridviews control last column is of a numericupdown celltype (found source on MSDN) and if the value entered is >1 I wish to add the number of rows specified to the datasource of the datagridview i.e a datatable in the dataset.

I can't add them to the datagridview directly as mentioned above the data is already bound.

I thought the UserAddedRow event would be the ideal (RowAdded would happen when I load data and only want my actions to occur when the USER adds a record) place to have the code to manually create new datatable rows.

So confused about the order of events really, the userAdded row is triggered whenever any of the columns in the datagridview is changed.

This therefore triggers before I can read in the users value from the numericupanddown.

I think it is important to add I have set default new row values in the DefaultValuesNeeded event.

Firstly I hope this makes sense, does anyone have some words of advice and guidance, of when I can validate the numericupanddown cell to allow me to manually create new datatable rows.

I can post code if it will make clearer to understand?

Thanks
Rob
 
I used the row validated event instead after realising the UserAddedRow event is triggered on any key or mouseclick in a column.

I still hate datagridviews :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top