C# - How to Removing Not Visible Rows From DataGridView

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
ocaccyAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Rikin ShahConnect With a Mentor Microsoft Dynamics CRM ConsultantCommented:
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
 
Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:
Hi,

Can you tell us how do you bind the data/new line to DataGridView?
0
 
ocaccyAuthor Commented:
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
ocaccyAuthor Commented:
Hi, Then those rows that are not seen and have no scrollbar have been deleted freeing memory?
0
 
Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:
Hi,

I did not get your last point. Can you clarify?
0
 
ocaccyAuthor Commented:
Thank you dear friend.
0
All Courses

From novice to tech pro — start learning today.