.NET - MikeBevers.be Skip to content

MikeBevers.be

Putting it out there…

Archive

Category: .NET

Context

I’m not a big fan of handling exceptions in stored procedures. It means that you have complicated queries, thus have some business logic in them. Although I like to keep my logic in code, sometimes it’s necessary to have some logic in your stored procedure.

Usually, I only use it to increase performance.

continue reading…

Background

When you’re creating a Mobile application, the UI is very important. Your controls cannot be too small, shortcuts cannot be used, and lots of other little things. I don’t like repetition, but I do like UserControls! So let’s bring in the “TSGrid”.

TSGridSource code: Touch Screen DataGridView Control

continue reading…

Background

Currently, I’m developing an application for a mobile device that runs on Windows XP Embedded. One of the requirements is that the application has to run in full screen mode. Also, a regular user should not be able to exit the application.

I was able to install the .NET 2.0 Framework on Windows XPe, so the front-end will be a WinForms 2.0 application.

continue reading…

The problem

I thought it would be usefull if there was a “Selection Changing” event on a ComboBox.

For Example: I have a ComboBox filled with Customers. Linked with the ComboBox is a UserControl which contains detailed information for the selected customer. On the UserControl I have validation methods. I wish that they are executed when the user wants to change the selected customer.

With a “Selection changing” event, I would still be able to cancel the new selection and still have access to the current SelectedItem.

continue reading…

The Problem

The other day, I was working on update / patch / setup patterns and stuff, when I noticed in the Windows Registry that the InstallLocation of my installed application was empty. You can find info on installed applications in the Windows Registry by typing “regedit” in the Run command and browsing to: “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\”.

Apparently, it is a known bug. So, we’ll have to fix it ourselves!

continue reading…

The Problem

A few days ago, I was toying with WiX (Windows Installer XML). When working with WiX, you need Guids for your product ID, upgrade ID, installer ID, …

To compile my installer, I needed valid Guids. So instead of always going to the web and use a guid generator, I decided to create a Macro in Visual Studio (2008) and link it with a shortcut to my keyboard.

continue reading…

A silly problem

After three years of programming WinForms, it’s the first time I’ve encountered this error.

It’s a pretty vague error “Too many items in the combo box.”, without an inner exception. Even weirder, my ComboBox was empty when I used the Add method to insert a custom DTO object. So I went into debug mode and after a couple of minutes, a bell rinkled.

continue reading…

A new task

Recently I was given a little task about extracting data from a SQL Server 2005 to a Microsoft Access database. The objective was to drop an Access file on a shared filesystem location within the company.

I chose to work with the SQL Server Integration Services (SSIS), which was built for such tasks. You can find some general info about SSIS on the Microsoft SSIS homepage.

SQL Server integration Services is an available option when you’re installing SQL Server 2005 (Standard, Developer or Enterprise Edition).

continue reading…

The problem

I was debugging an old project which used untyped DataSets. The DataTable contained timelisting details of employees. I already filtered the DataTable so I got all records for a certain employee. It still contained about 600 records. I needed to know the distinct dates on which the employee listed his time.

However, the DataTable class doesn’t contain a “SELECT DISTINCT” method. So before I would start doing crazy tricks, I asked my friend Google if he knew anything about the matter.

continue reading…

How it doesn’t work

I had to create a Form that closes when the user pressed his escape button.

So I the first thing that came up was the KeyDown or KeyPress event on the Form.

private void FormParameters_KeyDown(object sender, KeyEventArgs e)
{
    if (e.KeyCode.Equals(Keys.Escape))
        this.Close();
}

private void FormParameters_KeyPress(object sender, KeyPressEventArgs e)
{
    if (e.KeyChar.Equals(Keys.Escape))
        this.Close();
}

You don’t have to try this, because it doesn’t work.

continue reading…