Click here to Skip to main content
13,087,797 members (79,942 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 1:00am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Your question is not entirely clear but from what I can understand you may need to handle the DataGridView.DefaultValuesNeeded[^] event.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

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
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 21 Apr 2011
Copyright © CodeProject, 1999-2017
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