My problem is that when my grid is initialized as run time It is empty, but as soon as my dataset goes in the grid, the grid.rowcount goes to minimum of 12 even when my dataset has only 3 entries.
here is the part of code
Expand|Select|Wrap|Line Numbers
- a = cmbSheets.Text.ToString()
- Label2.Text = a
- oleDA = New OleDbDataAdapter("select * from [" & Me.Label2.Text & "]", connExcel)
- Dim sh As Integer
- 'grid.AutoSize = True
- a = cmbSheets.Text.ToString()
- Label2.Text = a
- ds.BeginInit()
- oleDA.Fill(ds)
- sh = grid.RowCount
- grid.DataSource = ds.Tables(0)
- sh = grid.RowCount
then after the datasource is defined the value goes to 12. The ds has a excel sheet with only 4 rows. I just don't get it!!
Because of this problem my program is limited to read only those excel sheets which have 12 or more than 12 rows.
Please HELP!!
what is the solution to this problem?