Avatar of ocaccy
ocaccy
Flag for Japan asked on

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
C#.NET ProgrammingProgramming Languages-Other

Avatar of undefined
Last Comment
ocaccy

8/22/2022 - Mon
Rikin Shah

Hi,

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

ASKER
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
ASKER CERTIFIED SOLUTION
Rikin Shah

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ocaccy

ASKER
Hi, Then those rows that are not seen and have no scrollbar have been deleted freeing memory?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Rikin Shah

Hi,

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

ASKER
Thank you dear friend.