473,699 Members | 2,600 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

1 New Member
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 839

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

Similar topics

3
2150
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 resized. but I find using this will make the controls on the form to flicker more. one can even restrict using WM_SIZING message but the position of the window is changing slowly while doing so. does anyone know the logic how the window minimum size...
3
1706
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 big. I thought I would be the size of the biggest property page plus some space for the next and previous buttons if needed. Are you aware of any minimum size for a wizard?
2
2328
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. -------------------------------------REPY---------------------------------- Hi Maybe i wasn't clear. I want to dynamically check whether what the lowest date and the highest date is in the calendar table. The presented solutions has fixed dates and i don't want that. If i could store a global...
12
16902
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 there is not a one to one map between a session and a physical TCP connection. A client may disconnect the TCP connection if it is idle for more than 60 seconds... yet a conceptual "session" may last for days at a time. It's necessary that the...
5
7100
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
2281
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 that will get put in the datagridview. The column is bound to a sql server 2005 image data field. I just need to know how to put the image in the column. Any help appreciated. Bob
0
1113
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 table has two columns ItemNum and ItemDescription Using a Datagrid View that is bound to the tblOrdersDetail table. When a users enters a number in the ItemNum column of the datagrid view I'd like the ItemDescription column of the datagrid view...
4
1897
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 online?
1
1810
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 bars. I don't want scrollbars, I want the control to shrink. In the .NET control, I have tried adjusting the minimum size and the auto size mode properties. In my view, I have tried setting the controls size when the view is resized. None of this...
24
2333
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 for is unsigned long -unsigned long, I figure it'd be a better idea to just cast the unsigned longs I'm inserted into the void pointer slots to avoid mallocs, frees, and unnecessary deferencing. On my machine, this is fine; void * are 32 bits. ...
0
8623
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9197
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9054
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8941
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.