473,320 Members | 1,939 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.

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 #1
10 8065
Hi,

To prevent the user from adding a new row set the
dataset.datatables.defaultview.allownew = false.

http://msdn.microsoft.com/library/de...ownewtopic.asp
Ken
---------------------
"Aaron Smith" <th**********@smithcentral.net> wrote in message
news:7B*****************@newssvr16.news.prodigy.co m...
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 #2
Hi,

To prevent the user from adding a new row set the
dataset.datatables.defaultview.allownew = false.

http://msdn.microsoft.com/library/de...ownewtopic.asp
Ken
---------------------
"Aaron Smith" <th**********@smithcentral.net> wrote in message
news:7B*****************@newssvr16.news.prodigy.co m...
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 #3
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...

Ken Tucker [MVP] wrote:
Hi,

To prevent the user from adding a new row set the
dataset.datatables.defaultview.allownew = false.

http://msdn.microsoft.com/library/de...ownewtopic.asp
Ken
---------------------
"Aaron Smith" <th**********@smithcentral.net> wrote in message
news:7B*****************@newssvr16.news.prodigy.co m...
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 #4
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...

Ken Tucker [MVP] wrote:
Hi,

To prevent the user from adding a new row set the
dataset.datatables.defaultview.allownew = false.

http://msdn.microsoft.com/library/de...ownewtopic.asp
Ken
---------------------
"Aaron Smith" <th**********@smithcentral.net> wrote in message
news:7B*****************@newssvr16.news.prodigy.co m...
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 #5
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**********@smithcentral.net> wrote in message news:wd*****************@newssvr16.news.prodigy.co m...
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...

Ken Tucker [MVP] wrote:
Hi,

To prevent the user from adding a new row set the
dataset.datatables.defaultview.allownew = false.

http://msdn.microsoft.com/library/de...ownewtopic.asp
Ken
---------------------
"Aaron Smith" <th**********@smithcentral.net> wrote in message news:7B*****************@newssvr16.news.prodigy.co m...
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 #6
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**********@smithcentral.net> wrote in message news:wd*****************@newssvr16.news.prodigy.co m...
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...

Ken Tucker [MVP] wrote:
Hi,

To prevent the user from adding a new row set the
dataset.datatables.defaultview.allownew = false.

http://msdn.microsoft.com/library/de...ownewtopic.asp
Ken
---------------------
"Aaron Smith" <th**********@smithcentral.net> wrote in message news:7B*****************@newssvr16.news.prodigy.co m...
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 #7
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**********@smithcentral.net> wrote in message news:wd*****************@newssvr16.news.prodigy.co m...
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 #8
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**********@smithcentral.net> wrote in message news:wd*****************@newssvr16.news.prodigy.co m...
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 #9
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**********@smithcentral.net> wrote in message news:Dv*****************@newssvr16.news.prodigy.co m...
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**********@smithcentral.net> wrote in message news:wd*****************@newssvr16.news.prodigy.co m...
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 #10
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**********@smithcentral.net> wrote in message news:Dv*****************@newssvr16.news.prodigy.co m...
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**********@smithcentral.net> wrote in message news:wd*****************@newssvr16.news.prodigy.co m...
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
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...
4
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...
3
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...
0
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...
0
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...
2
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...
3
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...
2
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...
0
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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...
1
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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: 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.