Vlad"s Software Development Toolbox

Tuesday, 26 June 2007

Tip: Working with generic SortedList in revers order

It was very interesting, but I could not find any information on how to work with lists like Generic SortedList<> in revers order. In the end all turned out very simple. You need to get a IList<> of keys and use for loop in descending order through that list. Below is a code snippet.

SortedList<int,DgvRowInfo> rowInfoList = null;
...
DgvRowInfo rowInfo;
// walk through the list in revers order
IList<int> keyList = rowInfoList.Keys;
for (int i = keyList.Count - 1; i >= 0; i--)
{
rowInfo = rowInfoList[keyList[i]];
dgvHandler.MoveRow(rowInfo.CurrentRowIndex, rowInfo.NewRowIndex);
}

Monday, 11 June 2007

Remember Row Position in the Grid - V1.1.2

Free Download

EnvMan-1.1.2.zip EnvMan-source-1.1.2.zip

Summary

Implemented fixes suggested by Code Project users.
  • Fixed reloading of Main Form on Row double click
  • Added remembering current row and setting it visible after reloading
  • Set Buttons State happens on Data Grid View current selection change
  • Fixed row deletion when user hits delete key on keyboard

Functionality Changes

  • Added Help Menu new entries.
  • Added credits box in About box
  • Modified CleanAll.bat to work with new projects
  • Added automated build of Setup project

Thursday, 7 June 2007

Tip: Versioning for EnvMan

I decided to drop off the 4th digit from the version number and stick to A.B.C format. “A” will be representing current program version. “B” is a version with new implemented feature. “C” is a version of the published fixes.

The future EnvMan release will be 1.2 with dropped 0 at the end. Any following fixes for a 1.2 release will be published with 1.2.x version.

The fixes for a current 1.1.1.0 release will be in 1.1.2 release

Saturday, 2 June 2007

Tip: Resolving file corruption error in settings file

I made an interesting discovery when working on saving splitter position into settings file. Initially I was calling SaveSettings function located in EnvManager DLL from EXE before EnvMan is closed. I started encountering file corrupted errors and application was not saving splitter position into a file. The work around was to use HandleDestroyed event of User Control to save settings from the EnvManager DLL. So my lesson was "Never call Settings class located in the different assembly to avoid file corruption errors". I will be interested to know if any one had similar experience when working with settings class and what work around was used to fix a problem.