|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Datagrid: missing first cell data
visual basic 6.0
I'm performing running an sql and populating a datagrid upon form load. I have placed on the form an ADO control (adodc1) and a datagrid (datagrid1). I'm setting the properties of both via code. The code works and the datagrid is populated except for the first cell in the first column and first row. All other cells are just fine. It does not matter how I arrange the sql (yes there are values in the database fields). what is going on? Here is the code: Private Sub Form_Load() Dim mySql As String Dim ConStr As String ConStr = "Provider=Microsoft.jet.oledb.4.0;data source =" & (App.Path & "\booktracks.mdb") mySql = "select * from books" Adodc1.ConnectionString = ConStr Adodc1.CommandType = adCmdText Adodc1.RecordSource = mySql Adodc1.Refresh Set DataGrid1.DataSource = Adodc1.Recordset End Sub If I set the adodc1 connection string at design time and also set the datagrid datasource at design time, ALL cells are populated correctly. What is the difference or what am I doning wrong? I need to set the connection string of the database at run time to be sure that the path to the database is correct. Any suggestions? Thanks, Jim |
|
#2
|
|||
|
|||
|
You could try leaving out the adodc1.refresh & see if it helps
|
|
#3
|
|||
|
|||
|
You need to go to the Custom settings of your datagrid then goto 'Splits' and set the 'Locked' value to on.
You could, if you wanted to, add a line like this prior to loading your database datagrid1.Splits(0).Locked = True Then, every time you want to edit the datagrid you should use a line like the following.... datagrid1.AllowUpdate = True datagrid1.Splits(0).Locked = False Once your edit is done lock it up again to keep it all safe. datagrid1.AllowUpdate = False datagrid1.Splits(0).Locked = True |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Datagrid: missing first cell data |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|