Solved

C# - How to Removing Not Visible Rows From DataGridView

Posted on 2014-01-09
6
804 Views
Last Modified: 2014-01-10
Hello everyone.

My environment: Windows 7 Ultimate, C#, VS2010 Ultimate, WinForm.
Target: Windows from XP to 7.
My application adds a line to a DataGridView in 1 minute intervals.
My DataGridView has 15 rows and 8 columns.
In the 16th to add data; first the DataGridView will roll up, insert a blank line and then add the data in this new line.
My question: The rolled up line of DataGridView is still in memory?
If yes, how to remove this line of the DataGridView, keeping in DataGridView memory only the data that are visible?

Thanks in advance, ocaccy
0
Comment
Question by:ocaccy
  • 3
  • 3
6 Comments
 
LVL 19

Expert Comment

by:Rikin Shah
ID: 39770248
Hi,

Can you tell us how do you bind the data/new line to DataGridView?
0
 

Author Comment

by:ocaccy
ID: 39770262
Hi,

private void tmr_GET_Tick(object sender,EventArgs e)
	{
	string[] row= { a_i_ler[i_C_AR, 0], a_i_ler[i_C_AR, 1], a_i_ler[i_C_AR, 2], a_i_ler[i_C_AR, 3], a_i_ler[i_C_AR, 4], a_i_ler[i_C_AR, 5], a_i_ler[i_C_AR, 6], a_i_ler[i_C_AR, 7]};
	dataGridView1.Rows.Add(row);
	}

Open in new window

Thank you,
ocaccy
0
 
LVL 19

Accepted Solution

by:
Rikin Shah earned 500 total points
ID: 39770268
Hi,

I don't know the internals of how DataGridView works but as and when the row has been added, the blank like will not exist any more. You can check this by taking a row count.

There is no need to explicitly remove the blank new line. The control itself will manage these changes.
0
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 

Author Comment

by:ocaccy
ID: 39770297
Hi, Then those rows that are not seen and have no scrollbar have been deleted freeing memory?
0
 
LVL 19

Expert Comment

by:Rikin Shah
ID: 39770517
Hi,

I did not get your last point. Can you clarify?
0
 

Author Closing Comment

by:ocaccy
ID: 39770836
Thank you dear friend.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
LINQ Select all records by MAX data syntax help 1 28
VS2010 Build fails to install 14 79
Reactjs with .NET 3 75
C# Windows Form Navigation - Total Beginner 9 46
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question