Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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
Rate this: bad
good
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.
  Permalink  
Rate this: bad
good
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.
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.
  Permalink  
Rate this: bad
good
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
    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
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 240
2 DamithSL 200
3 Raul Iloc 185
4 Richard MacCutchan 175
0 OriginalGriff 5,130
1 DamithSL 4,197
2 Maciej Los 3,670
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,821


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