Monday, February 23, 2009

C# update progressBar from backgroundWorker

private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
{
    progressBar.BeginInvoke(new MethodInvoker(delegate
       {
            //setProgress(10);
            progressBar1.Value += 10;
        }));
}

Thursday, October 30, 2008

A nice tutorial on Design Patterns

Design Patterns in simple examples.

Speed up DataGridView C#

The DataGridView in C# 2005 is very slow for about 15000 records.
Fixes:
  • AutoSizeColumnsMode = Fill;
  • BorderStyle = None;
  • CellBorderStyle = SingleVertical;
  • ColumnHeaderBorderStyle = Single;
  • ColumnHeaderHeightSizeMode = DisableResizing;
  • EditMode = EditProgrammatically;
  • EnableHeadersVisualStyles = False;
  • ReadOnly = True;
  • RowHeadersWidthSizeMode = DisableResizing;
  • ShowCellTooTips = False;

These settings were tested in Visual Studio 2005, in which works very well. I haven't tested them in VS 2008, but I thing they work as well.

Thursday, October 18, 2007

Speed up DataGridView C#

The DataGridView in C# 2005 is very slow for about 15000 records.
Possibly fixes:
  • none at this time

Saturday, June 16, 2007

Get the file that has been clicked after file association in Visual C# Smart Device Application

Yet another problem: if the file association works, how do you know, in a mobile environment, to get the file that has been clicked.

File Association using Visual Studio 2005 Smart Device Cab Project Part 2

I've found the answer to the file association problem


None of my files are signed, and the association still works (when I click a file in the File Explorer, the app is launched).

I have not found a way to export my registry keys from the deployment project (it may be possible using the ccregedt.exe in the CE Remote Tool, but it would just show the installed reg keys).

So, I opened the cab that cabwiz generates and extracted the _setup.xml file. Inside (at the bottom), you'll find the registry sections:

Thanks to vpborza


Sunday, June 10, 2007

File Association using Visual Studio 2005 Smart Device Cab Project

I am trying to make an installer for a SVG viewer for Pocket PCs running Windows Mobile using C# and Windows Mobile 6 SDK.
The installer works, but I am trying to make a file association. When I click on a SVG file the application should start and show that file. I've used registry keys like so:

HKEY_CLASSES_ROOT
|
+ .xxx (Default Value) xxxfile
|
+ xxxfile
|
+ DefaultIcon (Default Value) %InstallDir%\MyApp.exe, 0
|
+ Shell
|
+ Open
|
+ Command (Default value) ""%InstallDir%\MyApp.exe"" ""%%1""

but when I open a SVG file I get this error:
" The file 'filename' cannot be opened. Either it is not signed with a trusted certificate, or one of its components cannot be found. If the problem persists, try reinstalling or restoring the file"

If I open the application directly, it works, and the files are shown, so they are not corrupted.

If anyone has an ideea about what could be wrong, please leave a comment or email me.