Click here to Skip to main content
11,496,146 members (455 online)
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
See more: VB9.0 VB.NET
Hi to all.

I want to set default value in a datagridview field.

I dont have any code for read or write because i have a data source connection for this datagridview.
I want to run an sql to find the alternate key and put the value in the second column.
The second column the visible=false........

Thanks and regards.......
Posted 21-Apr-11 2:00am
Your question is not entirely clear but from what I can understand you may need to handle the DataGridView.DefaultValuesNeeded[^] event.
Your question is not that much clear but what I think is you want to Bind the Grid with the default values you get from database.
For that you have to assign your Data source to the DataGrid's bind property. Follow this link for more reference.[^]

If you describe your question clearly the more you will drove towards solution. So be precise in description of your question.
First of all Gandalf Thanks for your time.

So I have a datagridview that fill from one table from access.
In my datagridview i want to show 7 of me fields. (Totaly i have 9 fields)
In one of them i want to put a number that calculate before save and the other put the system date and time..

My datagridview for save has this code
Private Sub Movement_roller_DBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Movement_roller_DBindingNavigatorSaveItem.Click
End Sub

What can i do to fill my 2 hidden fields before save??????

I hope to be more specific
Thanks and regards

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 10,401
1 OriginalGriff 8,910
2 Sascha Lefèvre 3,899
3 Maciej Los 3,422
4 Richard Deeming 2,600

Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 21 Apr 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100