Hello,
I have a datagridview with scroll bar . I want to track the scroll event but I am not able to catch the scroll event
I tried the datagridview.Scroll but I didnt understand the event
Thank you
Pritha
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Nilanka DharmadasaRank #1,875 · 794 reputationPosted Jan 27, 2010, 11:51 PM EST
From that line, you bind 'dataGridView1_Scroll' method to 'Scroll' event of the datagridview. It means, when a user scrolls datagridview, 'dataGridView1_Scroll' method is called. This is how you bind events from code.
If you do not use this line in the code, you can set it from the designer too. If you call this from code, you should call it in the form constructor, after InitializeComponent() method. Do as i have done in my code.
Btw, when you tick your favourite answer, please make sure to tick the answer which actually helped you.
Thanks.
Gaurish Kumar108 reputationPosted Jan 27, 2010, 10:08 PM EST
If you are working on windows forms
then u can use the onScroll event of the datagridview like that
Lalit MRank #1,186 · 1.5K reputationPosted Jan 27, 2010, 10:13 PM EST
Link-1
Link-2
Nilanka DharmadasaRank #1,875 · 794 reputationPosted Jan 27, 2010, 10:24 PM EST
Yes. You can use scroll event for that. If you are not sure how to do that, check my code. It will help you for sure.
If you find this answer useful, please tick 'Do you like this answer' checkbox.
priya kalashi6 reputationPosted Jan 27, 2010, 11:04 PM EST
But what exactly is
dataGridView1.Scroll += new ScrollEventHandler(dataGridView1_Scroll);
and where do I need to call it from .
Priya