Click here to Skip to main content
15,888,239 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

Your question is not entirely clear but from what I can understand you may need to handle the DataGridView.DefaultValuesNeeded[^] event.
 
Share this answer
 
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.
http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/thread/2b5cab23-5894-450b-972d-57b4334bea2a[^]

If you describe your question clearly the more you will drove towards solution. So be precise in description of your question.
 
Share this answer
 
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
VB
Private Sub Movement_roller_DBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Movement_roller_DBindingNavigatorSaveItem.Click
    Me.Validate()
    Me.Movement_roller_DBindingSource.EndEdit()
    Me.TableAdapterManager.UpdateAll(Me.RollerDataSet)
End Sub


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

I hope to be more specific
Thanks and regards
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900