Solved

C# - How to Removing Not Visible Rows From DataGridView

Posted on 2014-01-09
6
786 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
Comment Utility
Hi,

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

Author Comment

by:ocaccy
Comment Utility
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
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:ocaccy
Comment Utility
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
Comment Utility
Hi,

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

Author Closing Comment

by:ocaccy
Comment Utility
Thank you dear friend.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now