Posts Tagged ‘.NET’

Redirecting MouseWheel events to another control

Redirecting events from one control to another is quite easy. I recently needed it for an application that uses a number of ComboBoxes to filter data in a DataGridView. It was very confusing to the user when she selected an item in the ComboBox and subsequently tried using the mouse wheel to scroll through the [...]

Social Icons Digg this page! Add this page to del.icio.us Bookmark this page on Google Bookmark this page on Google

Comments (1)

Fixing a slow scrolling DataGridView

Whenever your C#/.NET DataGridView reaches a certain size, it tends to get really slow to scroll. Depending on the speed of your computer this may be more or less noticeable. In an application i did for a client this became a real problem due to a combination of lots of DataGridView cells and fairly slow [...]

Social Icons Digg this page! Add this page to del.icio.us Bookmark this page on Google Bookmark this page on Google

Comments (43)

Understanding thread priorities in C#

Thread priorities in the .NET framework are more complex than many developers think. Setting Thread priority is more than just adjusting the ThreadPriority of a Thread. You also have to take into account the priority of the process to which the threads belong. The ProcessPriorityClass Setting ThreadPriority to one of the values possible with C# [...]

Social Icons Digg this page! Add this page to del.icio.us Bookmark this page on Google Bookmark this page on Google

Comments (3)

Voluntary fall through in C# switch statements

I used to use voluntary fall through a lot in switch statements in C and C++. In C# it is no longer as easy to do as before, since all cases of a C# switch are required to end with either break or goto. You can still do voluntary fall through. You just need to [...]

Social Icons Digg this page! Add this page to del.icio.us Bookmark this page on Google Bookmark this page on Google

Leave a Comment

String & StringBuilder performance in the Compact Framework

Here’s a few general guidelines when working with strings: Don’t concatenate strings – use a StringBuilder instead Whenever possible initialize the StringBuilder with enough capacity to avoid re-allocations Excessive concatenation of strings will be several orders of magnitude slower than using a StringBuilder String.Format() & StringBuilder.AppendFormat() are significantly slower than just using the +operator or [...]

Social Icons Digg this page! Add this page to del.icio.us Bookmark this page on Google Bookmark this page on Google

Comments (2)

Single instance applications in Windows CE

I programmed a Windows CE application last month that had as a requirement that only one instance could run at the same time. Had it been Windows Mobile, this had been handled by the OS, but on Windows CE you have to take care of this yourself. I was a bit surprised that there is [...]

Social Icons Digg this page! Add this page to del.icio.us Bookmark this page on Google Bookmark this page on Google

Comments (17)

Using embedded resource files in visual studio 2008

Why embed files ? Many of my projects use a lot of secondary files. It can be images, icons, xml-files, text, sound, whatever…. These files pose a couple of problems for me: They clutter the program folder. The user may accidentally delete or change them. They expose your graphics/sound files to stealing and copying. They [...]

Social Icons Digg this page! Add this page to del.icio.us Bookmark this page on Google Bookmark this page on Google

Leave a Comment

Profiling for the Compact Framework

Just wanted to share with everyone that there is a .NET Profiler that works with the Compact Framework. It is made by a Danish company called Eqatec and best of all; It is completely free. A long search has ended I have been looking for something like this for several years, but until the Eqatec [...]

Social Icons Digg this page! Add this page to del.icio.us Bookmark this page on Google Bookmark this page on Google

Leave a Comment

Downloading files from the internet with C#

With the .NET framework it has become very easy to programmatically download content from the internet. Using the WebClient class from the System.Net downloading a file from the net becomes as easy as specifying the address to download. There are several different ways to accomplish this depending on the type of file you want to [...]

Social Icons Digg this page! Add this page to del.icio.us Bookmark this page on Google Bookmark this page on Google

Comments (1)

Implementing a scrolling RichTextBox

It is often necessary to make a .NET RichTextBox scroll to the top or the bottom. Unfotunately there is no direct method of doing this in the class itself. One possible solution involves using the ScrollToCaret() function of the control. This method is outlined in my first post about RichTextBox scrolling. It appears that some [...]

Social Icons Digg this page! Add this page to del.icio.us Bookmark this page on Google Bookmark this page on Google

Comments (11)