c# - How to stop two datagridview from using Unison Scrolling to independently using toggle button -


i have 2 datagridviews have unison scrolling. want use button control unison scrolling , independently scrolling. question is, how can use toggle button control unison , independently(which means on , off).

i have created button , named lock. let me put in scenario.

1.you select 1 row grid1 , perform unison scrolling.(unison part working) 2.and click lock button allow unison scrolling. 3.toggle button off , scrolls independently.

how can ?

i have created , seems not working @ all

constructor of form:

public frmmain_page() {    grid1.scroll += new system.windows.forms.scrolleventhandler(grid1_scroll); } 

button unison:

     private void gridview_input_scroll(object sender, scrolleventargs e)     {       gridview_output.firstdisplayedscrollingrowindex = gridview_input.firstdisplayedscrollingrowindex;               } 

look button :

  private bool toggle = true;   private void btnlock_click(object sender, eventargs args)     {         try         {             if (toggle == true)             {                 toggle = false;      grid2.firstdisplayedscrollingrowindex =    grid1.firstdisplayedscrollingrowindex;             }             else             {                 toggle = true;     grid1.scroll += new system.windows.forms.scrolleventhandler(grid1_scroll);             }         }         catch( exception ex)         {          }      } 


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -