Chris Pietschmann

husband, father, hacker, entrepreneur, futurist, innovator, autodidact


Apple's iCal implemented in .NET/Mono

Now here's an idea that I've had since I first saw iCal and that someone else has now done. I haven't had a chance to install and play around with it yet, but the screenshots look good.

VB.NET: RegEx Syntax Highlighting RichTextBox

Here is a version of my code for syntax highlighting in a RichTextBox that incorporates regular expressions.   Download RegEx Syntax Highlighting RichTextBox Source Code Source Code Listed: Public Class SyntaxRTB Inherits System.Windows.Forms.RichTextBox Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _ (ByVal hWnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, _ ByVal lParam As Integer) As Integer Private Declare Function LockWindowUpdate Lib... [More]

C# .NET: Convert System.Drawing.Color to HTML color

Here is a small example of how to convert a System.Drawing.Color to the HTML color format (Hex value or HTML color name value) and back. System.Drawing.Color c = System.Drawing.ColorTranslator.FromHtml("#F5F7F8"); String strHtmlColor = System.Drawing.ColorTranslator.ToHtml(c);

Scrape Geocodes from Google Maps w/ C#

I need to geocode some addresses once in a while and I notice if you view the source of the Google Maps page, the geocodes are right there. So instead of looking at the source of the page manually, I just created a little app that scrapes them from the page for me and places them into textboxes. Below is a small code snippet I wrote that does just that. It's not perfect but it is simple and it just plain works. string lat = "";string lng = "";string address = "1 Microsoft Way, Redmond WA"; ... [More]

The My namespace in Visual Basic 2005 is extensible!

Yes, that's right. You can add your own custom functionality to the My namespace. Microsoft has even created a My.Blogs library that adds functionality for read and writing to blogs. And, there is an MSDN TV episode that explains how to use My.Blogs. Simplify Common Tasks by Customizing the My Namespace My.Blogs Code Sample for Visual Basic MSDN TV: Adding Blogging to Your Apps with ... [More]

.NET Framework - Check if Windows booted in Normal or Safe Mode

Heres a really small code sample on how to check which mode Windows was booted up in (Normal or Safe Mode). This works in .NET 1.x and 2.0.   1 'This code checks to see which mode Windows has booted up in.  2 Select Case System.Windows.Forms.SystemInformation.BootMode  3 Case BootMode.FailSafe  4      'The computer was booted using only the basic files and drivers.  5      'This is the same as Safe Mode  6 Case BootMode.FailS... [More]

Boolean Expression in .NET: strName IN ("CHRIS","TOM","TYLER")

I think it would be really helpful if we could do boolean expressions with IN sort of like we can in SQL. For Example:   'just like SQL   If strName IN ("CHRIS","TOM","TYLER") Then      'do something   End If    'using an array for this would be best   Dim arrNames() AS String = New Array{"CHRIS", "TOM", "TYLER"}   If strName IN arrNames Then      'do something   End If &nbs... [More]

VB.NET: Syntax Highlighting in a RichTextBox control

This last weekend I expirimented a little bit with extending the functionality of the RichTextBox control. Below you'll find an example of a small class that enherits from the RichTextBox control and allows you to implement syntax highlighting (with the use of a couple Win32 API call to smooth over the process of course.) The code pretty much speaks for itself.   Public Class SyntaxRTB    Inherits System.Windows.Forms.RichTextBox    Private Declar... [More]

Visual Studio 2005 Beta 2: Error 50266 installing .NET Framework 2.0

I ordered Visual Studio 2005 Beta 2 about 2 weeks ago, and I received it in the mail yesterday! The SQL Server 2005 CTP cam with it! I couldn't wait to install them and start playing. I didn't play around much with Beta 1; I just didn't make the point to spend much time with it (There are so many things to learn/do I can hardly find the time for it all.) One of the reasons I'm so excited about Beta 2 is because of the Go Live license (which you must go onlin and sign first; located here: http://... [More]

Giving your application a Plugin based architecture is easier than it sounds...

I've been playing around the last couple of days with creating an application with a Plugin based architecture. It's alot easier with .NET than it sounds. I don't have any examples or articles to post on here yet, but I'm working on something I hope to have up here in the next week or so. On another note, the traffic of my site is using about 1GB of bandwidth per month now (consistantly the last two months). That's the most my site has ever used, I'm going to have to upgrade my hosting account ... [More]

WI-INETA: Need for Speed: .NET Performance Tuning (April 12)

The next WI-INETA meeting is on April 12th. Jacob Cynamon will be speaking on the topic of Need for Speed: .NET Performance Tuning. Jabob will show us tips and techniques to fine-tune the performance your WinForms applications. The key areas of focus for this session will be data processing, memory management, and startup time. For more information: Jacob Cynamon's Blog:

VB.NET: Make a Form semi-transparent when moving and resizing it

Here's a little VB.NET code snippet that I wrote to make a Form semi-transparent when moving and resizing it. I think this is a neat little effect to add to an application.   Public Class frmTransparentMoveResize Inherits System.Windows.Forms.Form Private _OpacityResize As Double = 0.5 Private _OpacityMove As Double = 0.5 Private _OpacityOriginal As Double Private Const WM_NCLBUTTONDOWN As Long = &HA1 Private Const WM_NCLBUTTONUP As Long = &... [More]

Why can't IIS implicitly share ASP Session state with ASP.NET??

Why can't IIS implicitly share ASP Session state with ASP.NET?? This is really a drag on starting to convert an ASP application to ASP.NET. Of course, you could use SQL Server to store your Sessions state, but then you'd have to rewrite that portion of your ASP application first. I don't want to, Why can't I just use Session(”myData”) in ASP and ASP.NET and have it point to the same Session value? C'mon guys!!

WI-INETA Meeting on Service Oriented Architecture

I went to the WI-INETA meeting last night. Matt Terski presented on Service Oriented Architectures. Matt is an accomplished software architect who has had significant real-world experience working with Fortune 500 customers on developing services oriented architectures with .NET technologies. Matt is also the President of Serlio Software which is located in Wauwatosa, WI. You can view Matt's blog at He provided an awesome presentation explaining the theory an... [More]

Regular Expressions are pretty neato...

I never worked with regular expressions before. I heard how great they can be, but never really knew. Regular expressions are really cool. RegEx Sample: Number with 0 to 3 decimal places  (|\-)\d+(.\d{3}|.\d{2}|.\d{1}|) Regular expressions look pretty complex and sort of cryptic at first glance, but if you have a good tutorial to go through it one part at time they aren't really difficult to learn how to write. This site has some good tutorials on Regular Expressions: http://www.regular-... [More]

VB.NET 2005's "My" namespace for Mono

Today, I started creating my own implementation of the VB.NET 2005 “My“ namespace. The target platforms for my implementation are .NET v1.1 and Mono v1.x  Heck, maybe eventually I could convince the folks over at the Mono project to put my code into their implementation of the .NET Framework, but I suppose I'll have to get alot more done on it first. If you don't know what the “My” namespace is check this out: [More]

Write to the Event Log in .NET (VB.NET and C#.NET)

It is as simple as this to write to the Windows Event Log in .NET Declaration: Imports System.Diagnostics Code: Public Function WriteToEventLog(ByVal Entry As String, _ Optional ByVal AppName As String = "APlusFeeCalc", _ Optional ByVal EventType As EventLogEntryType = EventLogEntryType.Information, _ Optional ByVal LogName As String = "Application") As Boolean      Dim objEventLog As New EventLog      Try... [More]

Why do we need to handle the RowUpdated event of our DataAdapter in order to reflect the ID in a Primary/Foriegn key relationship??

Why do we need to handle the RowUpdated event of our DataAdapter in order to reflect the ID in a Primary/Foriegn key relationship?? Well, anyway here is a page that tells you how to do this. AddHandler daChargeAttendance.RowUpdated, AddressOf FeeChargeAttendanceRowUpdated Private Sub FeeChargeRowUpdated(ByVal sender As Object, ByVal e As SqlRowUpdatedEventArgs)     Dim oCmd As SqlCommand = New SqlCommand("SELECT @@IDENTITY", e.Command.Connection)    ... [More]

Fill DataSet with multiple Tables and update them with DataAdapter

One way to fill a DataSet with multiple tables is to send the database multiple requests. Another way to do this is to use multiple SELECT statements in a single request. There are a couple of problems with doing it this way: The DataTables don't have the same name as the tables in the database, you have to set them yourself You can't update/save the tables to the database; to do that you must use a seperate DataAdapter for each table. Dim myAdapter as SqlDataAdapter = new SqlDataAdapter( ... [More]

Visual SourceSafe 6.0 Automation

One of my clients has a web application that automates updating their clients sites with the latest ASP pages, DLL, and SQL scripts on their databases. This week the idea came up of having that web application grab the latest version of the appropriate ASP pages from SourceSafe during this automation process. We figured it could be done, since Visual Studio can automate SourceSafe, and it also wouldn't be like Microsoft to not make that sort of thing automatable. Below are two links to documenta... [More]

Paint.NET - This thing is like MS-Paint on steroids

Paint.NET is a senior design project aided by a mentor at Microsoft.  It is a paint program designed entirely by students and written using Microsoft's .NET Framework.  The program makes it easier to create and edit photos. It maintains some of the best features of the original MS-Paint application and includes new, powerful tools. Such new tools include a history storage for undos and redos, and powerful multi-layering which is often seen only in high-quality, expensive photo-appl... [More]

XAML is like HTML for Windows Applications!

XAML is just plain awesome. XAML will allow you to configure the user interfaces of you applications using an XML based language. Just think of how easy it is to create a web interface with HTML, and that is how XAML will be for Windows applications. It's just too bad that it wont be supported by Windows until Longhorn ships. I can't wait to start using it. The following example demonstrates that all you need to do to write a "Hello World" application in XML is to initialize a window class and ... [More]

Get Visual Basic .NET 2003 for FREE!!

Get Visual Basic .NET 2003 for FREE from the Visual Basic at the Movies website. All you have to do is watch 5 short videos on how to use VB.NET and fill out a short 6 question survey for each movie, then like magic you can get a copy of Visual Basic .NET 2003 Standard for FREE!! Shipping is also FREE.