Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


C# - How to Removing Not Visible Rows From DataGridView

Posted on 2014-01-09
Medium Priority
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
Question by:ocaccy
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 19

Expert Comment

by:Rikin Shah
ID: 39770248

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

Author Comment

ID: 39770262

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]};

Open in new window

Thank you,
LVL 19

Accepted Solution

Rikin Shah earned 2000 total points
ID: 39770268

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.
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal


Author Comment

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

Expert Comment

by:Rikin Shah
ID: 39770517

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

Author Closing Comment

ID: 39770836
Thank you dear friend.

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

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.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Suggested Courses

636 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