I have a Windows form app. I get data based on a row position in a DataTable. I have a TotalCount variable and a CurrentPos variable. The button next should get the next row and the button previous should get the previous. These buttons should be enabled/disabled when there is data available.
My brain is much can you provide the logic
From stackoverflow
-
Is it not a simple
m_NextButton.Enabled = CurrentPos < (TotalCount - 1) ; m_PreviousButton.Enabled = CurrentPos > 0;You need to call this when you
- Add to your DataTable
- Change Your Selection
- Remove from your datatable
Jon : At what point do you increment the CurrentPos, before the call to get records or after. When the form starts the CurrentPost = 0 but you can't increment before the call to get records as it will miss the first recordJon : Not to worry, I have done it. Thanks for your help, having a bad brain day! -
You might also want to look at the BindingNavigator class which will do this for you
0 comments:
Post a Comment