473,320 Members | 1,948 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Datagrid View Problem : Datagrid is Taking a Minimum size of 12 automatically!!

I have A datagrid which is filled by a dataset which takes an excel sheet as input.

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
  1. a = cmbSheets.Text.ToString()
  2.         Label2.Text = a
  3.         oleDA = New OleDbDataAdapter("select * from [" & Me.Label2.Text & "]", connExcel)
  4.         Dim sh As Integer
  5.         'grid.AutoSize = True
  6.         a = cmbSheets.Text.ToString()
  7.         Label2.Text = a
  8.         ds.BeginInit()
  9.         oleDA.Fill(ds)
  10.  
  11.         sh = grid.RowCount
  12.         grid.DataSource = ds.Tables(0)
  13.  
  14.         sh = grid.RowCount
the first value of sh is 0

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?
Oct 4 '13 #1
0 828

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Harry_Crow | last post by:
I want to restrict the minimum size of the form. I find that there are properties MaximumSize and MinimumSize. This will help you control the maximum and minimum size the form, when the form is...
3
by: luc h | last post by:
Hello! I'm trying to make a very simple wizard. I have 3 different property pages and the property sheet is set to be a wizard. The problem is the size of the wizard dialog which is much too...
2
by: Hennie de Nooijer | last post by:
Because of an error in google or underlying site i can reply on my own issue. Therefore i copied the former entered message in this message....
12
by: David Sworder | last post by:
Hi, I'm writing an application in which a client (C#/WinForms) and server (C#/service) interact with one another. The client establishes a "session" with the server but for scalability reasons...
5
by: ComputerStop | last post by:
I am attempting to print a datagridview. I have not found any method that works successfully. Has any one been successful with this?
2
by: Bob | last post by:
I looked at the sample in the msdn january 2005 - Introducing a new datagrid, but the project downloaded failed to open. Any one can point me to a bit of code on how to go and select an image...
0
by: Tony A. | last post by:
I'm using VB 2005 with MS Access for as the database. I have a table (tblItem) that has two columns, ItemNum (key field) and ItemDescription. I also have a second table (tblOrdersDetail), this...
4
by: cpp_novice | last post by:
What is the minimum size of 'long' according to the ANSI 1990 standard? I thow that c99 requires longs to be atleast 32bits wide. Is there an electronic copy of the 1990 standard available...
1
by: MLM450 | last post by:
I am using CWinFormsView to host my C# control. When I resize the view window to a larger size the control seems to grow with it just fine. But when I shrink the size of the view, I get scroll...
24
by: Rob Hoelz | last post by:
Hello everyone, I'm working on a hashtable-based dictionary implementation in C, and it uses void pointers for data storage, naturally. However, since one of the data types I will be using it...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.