473,836 Members | 1,539 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fixed number of rows in a datagrid

If I have a datagrid and the bound data file only have 4 rows in it, the
grid will show the 4 rows. However, there is blank space below that
until it reaches the bottom of the grid. Is there a way to have a fixed
number of rows regardless of what data is in the bound table?

Thanks,
Aaron
--
---
Aaron Smith
Remove -1- to E-Mail me. Spam Sucks.
Nov 21 '05
10 8143
Your welcome Aaron. The one thing I did think of is, you could append empty rows with null values in each cell at the end of the
actual rows that hold data and then set Edit to the first empty row with the null values. But, I think that would end up
getting pretty messy. You would have to set the display of the grid in such a way that the grid would never show more than 10
rows (empty or not) and if there were any rows without actual data in them, then append as many empty rows as needed to make up
the difference.
Then each time your user added new data to the empty rows, till it filled the 10 row limit, have them scroll and then re-append
more empty rows as needed. See what I mean? It would be a mess keeping track of all that. I would show your boss the new way to
do things and let him see how nice that can be.
james

"Aaron Smith" <th**********@s mithcentral.net > wrote in message news:Dv******** *********@newss vr16.news.prodi gy.com...
Thanks for the repsonse James. You have the idea of what I want exactly right. I know this is not standard. The problem is, we
are converting software over to VB.Net that was written in another language. In that language, they had the grid as I
explained. My employer wanted to recreate that. If there is no way to do it, then so be it, I'm not going to go through the
work of rolling my own datagrid just to have that happen. The way the other language would work, is you had the grid and you
could not navigate to the other rows if they were blank. You could only go to the one row following the last row of data, so
that you could enter in a new row.

Thanks again,
Aaron

james wrote:
I don't think you can do that with the datagrid that comes with VB.NET. If I understand you right you want to have a grid
drawn on the screen that has , say 10 rows(with columns) visible, even if there is only 3 of those rows populated with data.
Is that right?
With the regular datagrid, I believe you can only have one extra row visible(that is if you have Allow Edit enabled) and it
is to allow your user to input new data. I think you will have to draw your own datagrid to do what you are wanting to do.
I really don't understand why you would want to do that anyway. That is not common practice with most applications that use a
datagrid to display data and allow editing. Besides, think about this, if you did have it that way, then your user could
skip a row and insert a blank row into the database. Personally, I don't want that to happen.
Well, that's my .02 and it is only my opinion. Good luck on finding a fix to what you are wanting to do.
james
"Aaron Smith" <th**********@s mithcentral.net > wrote in message news:wd******** *********@newss vr16.news.prodi gy.com...
Actually, I don't want to prevent them from adding a new row. I have a grid that is about 6 inches long, and with only 3 rows
of data more than half of the grid window is blank with no rows. I want that whole area to look like the grid. I can't really
think of a good way to explain it... If a grid can have up to 10 lines before scrolling, I want all 10 lines to be there
whether there is data or not...

--
---
Aaron Smith
Remove -1- to E-Mail me. Spam Sucks.

Nov 21 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1243
by: Alpha | last post by:
I'm working on a Window based application. I have 2 textboxes and a datagrid on a form. The textboxes are databind to the same datasource as datagrid. I want to use the following to update the dataset but I am not suer if the datagrid's current row number does corresponds to the row number in the dataset table that I want to update. Appreciate it if someone can give me answer to this. Thanks, Alpha private void...
4
2208
by: Tim T | last post by:
Hi, I have a stored procedure executing a search and an asp.net page displaying the results in a datagrid. The datagrid has paging on it, I am using Visual Studio.NET and can't see any option to show the number of results found. Is there an easy way to add this to the top of the datagrid, along with the total number of pages ie: 67 resuts found page 1 of 7 (where the numbers in are hyperlinks to that
3
2158
by: Mau | last post by:
I have a question: I have a datagrid with paging (4 elements for page), header and footer I set a fixed height: 600px So the situation is (in a page with 5 elements) 6 rows (header + 4 elements + footer) every with fixed height 100px, and this is ok but in a page with 1 element (for example) I have 3 rows (header + 1 element + footer) every row is 200px height
0
1388
by: John Shum | last post by:
I prepare a UserControl that act as a lookup control, once the code is enter in the TextBox, the description will appear in another TextBox outside the UserControl of the same row in a DataGrid via javascript. I attempt to get the client ID of the TextBox (with provided ID of that TextBox as "ext_desc") by the following code inside the Page_Load() event of the UserControl (named Color_Control): for(int i = 0; i < DataGrid1.Items.Count;...
0
357
by: Aaron Smith | last post by:
If I have a datagrid and the bound data file only have 4 rows in it, the grid will show the 4 rows. However, there is blank space below that until it reaches the bottom of the grid. Is there a way to have a fixed number of rows regardless of what data is in the bound table? Thanks, Aaron -- --- Aaron Smith
2
11130
by: patang | last post by:
I found the following to count the total number of VISIBLE rows of datagrid datagrid.visiblerowcount How do we count the total number of ACTUAL (not just visible) rows of datagrid? Thanks in advance.
3
2142
by: Gerhard | last post by:
I would like a DataGrid I am using to show a default number of rows (10) with the heading, even if the dataset it is bound to returns less than that number of rows (0-9). It is a databound grid that sometime returns less than 10 rows (paging is enabled with a row count of 10). I would like the grid to always show 10 rows (blank rows if no data bound to them). Is there a way to do this?
2
3464
by: Lars Netzel | last post by:
Hi I need to have a limitation for the number of rows one can add in a datagrid (bound from a DataTable), in this case maximum should be 10 rows. My approach I guess is to catch the rownumber in the CurrencyManager via BindingContext.PositionChanged but how do I then stop new rows from being created? in FormLoad() I add a handler for the bindingcontext and a datatable called
0
6191
by: sysmanint1 | last post by:
I am a total neophyte at Visual Basic but found the following post and reply from Clint concerning a dynamic range. Also, have never "posted" to a discussion I have made a macro that works on a template spreadsheet with a fixed number of columns to be "macro'd" bounded by data that changes in its number of rows. That is, the bounding data is imported to the spreadsheet before the calculated columns are run. But the rows of this data...
0
9825
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
10852
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
10553
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...
0
10255
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5651
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
5829
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4459
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4021
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3116
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.