Sven's Blog

MemoryStream ms = new MemoryStream(MyBrain); // Management and technology considerations

Subscriptions

<July 2010>
SuMoTuWeThFrSa
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

News

Welcome to my spot on the 'Net. I am the Principal Consultant at Adduxis, a management and IT consulting firm. This blog will provide you with some (hopefully) useful information and links to tidbits found on the Internet.

Navigation

Post Categories

Microsoft Bloggers

SQL Saturday #17 in Baton Rouge, LA

SQL Saturday #17 is scheduled to take place in Baton Rouge, Louisiana on August 1 (yes, it's a Saturday :o)). I will present on the ADO.NET Entity Framework version 4 and on SQL Server 2008 FILESTREAM.

There are many other great speakers lined up, and as always, the event is free to attend. It's an excellent opportunity for learning, networking, and skipping out on the honey-do list for another week.

Hope to see you there!

posted Tuesday, July 14, 2009 12:58 PM by SvenAelterman with 0 Comments

How do students get the skills they need upon graduation?

This is probably one of the most common questions IS students ask: How come you don't teach ? The answer is usually one of the following: we can't, because of time constraints, because we may not be versed well enough in the technology to teach it, and because at a four-year traditional institution, we teach career skills (i.e. long-term focus) and not job skills.

The question is nonetheless relevant. Students should not expect to only spend time in class and on coursework and then find the highest paying positions upon graduation. It is going to take a lot more effort and time. However, it doesn't have to cost a lot of money. Students can't afford to pay for the traditional courses offered by technology vendors or third-parties, they can't afford to attend the industry conferences, etc.

They can however join the major national associations as student members, where they mostly receive the same benefits professional members receive, but at a fraction of the cost. The Association for Computing Machinery (ACM), IEEE (originally short for Institute of Electrical and Electronics Engineers) and Society for Information Management (SIM) all have such incentives for students to join.

What are the benefits for students? Plentiful: they include access to digital libraries (often full text, as well as abstracts), online books from Books24x7 or Safari, and online courses.

posted Wednesday, June 10, 2009 8:23 PM by SvenAelterman with 0 Comments

SQL Saturday #14 in Pensacola, FL coming up (June 6)

If you are not familiar with a SQL Saturday, it's like a Code Camp, but focused on SQL Server.

SQL Saturday #14 is the Pensacola, Florida event for 2009. The lineup of sessions, location, and registration is available from the SQL Saturday web site at http://www.sqlsaturday.com/eventhome.aspx?eventid=18.

I will be presenting a session on the SQL Server 2008 FILESTREAM feature.

On side note, I like the concept of sqlsaturday.com: one site where all SQL Saturday events are managed from. Makes me think we need something like this for Code Camps also. It cuts down on the amount of coding each organizing committee has to do, allowing them more time to focus on the actual organization. Attendees and presenters benefit from the uniform interface.

P.S.: There is one May 30 in Birmingham, AL also. I will not be attending that event though.

posted Friday, May 29, 2009 8:27 PM by SvenAelterman with 0 Comments

Atlanta Code Camp 2009 Wrap-up

From what I saw, the Atlanta Code Camp yesterday, March 14, was a success. Attendance was great, there were many sessions, and the location (Georgia Gwinnett College) is very well suited for a Code Camp.

Thank you to those who attended my sessions on the ADO.NET Entity Framework and SQL Server 2008 FILESTREAM. Unfortunately, we ran short on time in both sessions. Still, all the major points came across. The downloads from the session are available now (see below). The downloads include my PowerPoint slides, my demo scripts, start and finish code of each demo, and (where applicable) starting database.

Any follow up questions or comments are welcome.

posted Sunday, March 15, 2009 3:13 PM by SvenAelterman with 0 Comments

Logging on as Administrator is a bad idea...
For your day-to-day activities, that is. The blog post below points this out one more time:
NEWS: “Removing end user admin rights eliminates 92% of vulnerabilities"
This advice holds independent of operating system, version, etc.
I do believe though that Vista's User Account Control (UAC) provides significant security and usability benefits by allowing people to easily provide administrative credentials or elevation of privilege to selected processes.

posted Tuesday, March 03, 2009 12:37 PM by SvenAelterman with 0 Comments

Office 14 Ship Date in 2010

From ComputerWorld:
Microsoft: Office 14 won't ship until 2010

Is it the economy? I wonder how Software Assurance customers feel about this... After all, they are the ones who have already paid for it!

posted Friday, February 27, 2009 8:43 AM by SvenAelterman with 0 Comments

Atlanta Code Camp 2009 Coming Up
The 2009 edition of the Atlanta Code Camp is scheduled for March 13, 2009 at Georgia Gwinnett College.
I will be presenting two sessions in the Data track: one on the Entity Framework and a second one on the FILESTREAM feature in SQL Server 2008.
Post a comment to this blog if you are interested in meeting up!
For information and registration, see http://www.atlantacodecamp.com.

posted Friday, February 06, 2009 8:00 AM by SvenAelterman with 0 Comments

Atlanta Code Camp 2007 Session
The Atlanta Code Camp 2007 (http://www.atlantacodecamp.com) was another successful CodeCamp event.

I presented a session on creating a custom extender with ASP.NET AJAX RC. If you were present in Montgomery, you'll find the download from the Atlanta Code Camp useful, as it has been revised for RC (I used Beta 2 during the Montgomery CodeCamp).

The download (zip file containing demo script and code) is available here.

posted Wednesday, January 24, 2007 2:37 PM by SvenAelterman with 0 Comments

Alabama Code Camp 3 Experience
Yesterday's third Alabama Code Camp was a good experience for me. Contrary to my post on 9/12, I did not do a talk on Windows Communication Foundation, but added a session on creating an Extender with ASP.NET AJAX ("Atlas").

The evening before the event, I was asked to take over a session for Joe Healy, who had a family emergency. His talk was an introduction to ASP.NET AJAX and fit right in with mine. I had to scramble to prepare for that talk, but managed to do it just in time for the session's start.

P.S.: To those who attended my sessions, thank you for the feedback and the response. I enjoyed the questions and interaction. The slides, code and demo scripts will be posted later today.

Upcoming Code Camps
Next spring, there is a Code Camp in the works for Mobile. I will likely make plans to attend and present some sessions there too.
A code camp is scheduled in Atlanta on January 20th. I have not yet made a decision about attending.

posted Sunday, October 29, 2006 8:20 AM by SvenAelterman with 0 Comments

Alabama Code Camp No. 3: October 28, 2006

The Alabama Code Camp is having its third edition on Saturday, October 28th in Montgomery (Auburn University at Montgomery). I missed the second edition, because Huntsville is quite a while away from Troy. However, Montgomery is probably as close as it will come, so I will be there.

I have submitted a proposal for a talk on unit testing with Visual Studio Team System, and I am considering an updated talk about web services with Windows Communication Foundation (WCF) and a new talk about Windows Workflow Foundation (if I get around to developing some demos for it).

I truly enjoyed the talks I attended at the first Code Camp. The content was interesting, at the right level, and presented well. I encourage every developer in the area to attend. There are already a number of sessions scheduled, but I believe there will be many more to come.

See you in Montgomery!

posted Tuesday, September 12, 2006 7:50 PM by SvenAelterman with 0 Comments

Visual Studio Orcas: What is Microsoft Planning?

The title of this post might actually be more appropriate if it was called what aren't they planning. If you've been reading my blog, you'll know that I was an active beta tester during the Visual Studio 2005 beta period. Microsoft sent me (and many others) a Customer Appreciation Award. Nice token, thanks for that.

However, after the release of VS 2005, I still found some annoyances. I posted two feedback items at the Microsoft Connect site ([1] and [2]) on November 21. Only now have I gotten feedback on those items' status. I can understand that, the team had probably lots of other things on their mind, such as VS 2005 Beta 1.

However, I am concerned about the reply that was posted for both topics. If you have a Microsoft Connect account, I encourage you to look at the items and judge for yourself; but, in my opinion, these are fairly minor changes. One would require adding a missing runat="server" attribute to a tag when Local Resources are generated and another would involve automatically generating resource entries for columns in a GridView. The response I got to both items basically stated that these items won't be fixed for the Orcas timeframe because they would produce breaking changes and the goal for Orcas is to have "a high degree of backward compatibility" [3]. It turns out that the requests I submitted are in the "Red" bits (read the blog post at [3]).

I am concerned because first of all, I was hoping for a fix for these items in a Service Pack; and seeing as how "Orcas" is now supposed to be just a Service Pack where it concerns "Red" bits (again, see [3]), I was certainly hoping for a fix in that time frame. Now, it turns out that even such minor feature changes are not considered for Orcas. So, it seems to me that

Orcas = VS 2005 + (WPF, WCF, WWF designers)

just like

.NET 3.0 = .NET 2.0 + WPF + WCF + WWF

When will that huge dev team at Microsoft get going on delivering high quality software on time on a reasonable schedule?

Sven.

P.S.: Those readers who think I believe Microsoft is the next best thing since sliced bread... there you have it ;o)

[1]: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=104600

[2]: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=104598

[3]: http://blogs.msdn.com/somasegar/archive/2006/05/18/601354.aspx

posted Monday, August 28, 2006 8:24 AM by SvenAelterman with 0 Comments

Windows Vista Developer Training: WCF Lab 2 Update

(Note: This is my first "live" blog post...)

I am in Atlanta for Windows Vista Developer Training. I've had a chance to get used to the user experience (UX) in Windows Vista, and I like it. The developer side of Vista is exciting also, but is clearly still in the works. The lab exercises that are provided are those that were also used during the PDC. They have been updated to an extent.

But on my machine, I installed the Vista July CTP build (build 5472) with its matching .NET Framework 3.0. The Windows Communication Foundation lab 2 went fairly well, but did require some changes to the code. I've uploaded my solution for lab 2 here [2]. Hopefully, this can be of use to someone who's trying the lab on a recent build.

The main differences are here: The Session property of the OperationContractAttribute is now called SessionMode and has changed from a boolean value to an enum. The MSMQ exercise in the lab requires an additional configuration attribute in the tag, "exactlyOnly="false"". (Unless you enable transactional support first; but in the lab, this is done later)

[2] http://www.adduxis.com/downloads/WCF_HOL2/TradingService.zip

posted Friday, July 28, 2006 10:34 AM by SvenAelterman with 0 Comments

A Currency MaskedTextBox for .NET 2.0

At a customer's site, an application needed to format and accept formatted input for currencies. They had already made several attempts at getting the .NET 2.0 WinForms MaskedTextBox to behave the way they wanted, without success.

A quick search reveals that they were not the only ones struggling with this issue. However, Irena Kennedy [1] had posted some sample code that would make the MaskedTextBox behave more appropriately. While the sample provides an excellent overview of how to handle currency values, two features were lacking:

  • Support for the currency group separator (the , in the US English culture)
  • Support for different cultures (important, considering the fact that the default MaskedTextBox allows you to specify a culture)

The download below [2] is a zip file containing a sample implementation for both of the above features. The code is based on Irena's code. Feel free to download this sample and use it in your applications. However, I provide no warranty whatsoever that this CurrencyMaskedTextBox will suit your needs. If you make any modifications, please continue to include my name and Irena's name.

[1]: http://blogs.msdn.com/irenak/archive/2006/03/21/556434.aspx

[2]: http://www.adduxis.com/downloads/CurrencyMaskedTextBox/CurrencyMaskedTextBox01.zip

posted Wednesday, June 21, 2006 3:09 PM by SvenAelterman with 0 Comments

Blog is still alive, although on life support

I couldn't blame anyone for thinking that this blog is dead. However, it's not. I could come up with scores of excuses as to why I haven't posted anything, but that won't serve any valuable purpose.

Rather, I'd like to write something about the subjects I can post about, namely

  • The betas of Windows Vista and Office 2007.
    I've installed them both, and I am gradually learning the differences and the exciting new features. Many pundits always claim that upgrades such as these have very little to offer in terms of business value. While I believe that they often make good points, I also think that for true "Information Workers" (I don't like that term very much...), the differences between Office 95 and Office 2007 are certainly significant. I am using such a big timespan to illustrate that over an 11-year period, there are significant advances in software. If each individual upgrade didn't provide benefits, where did these combined advances come from?
    Office 2007's new user interface is radically different. My first experiences with it are positive. I've been used many of the advanced features of Outlook and Word (Excel somewhat less) for many years now. Naturally, I was apprehensive about this new interface. I was afraid that I wouldn't be able to find the commands I was looking for anymore. Good news on that front: everything is right where I would expect it to be. The first time using a command, it might take perhaps a second or two, but the new interface grows on me quickly. Whether or not novice users will now actually be able to find and use the advanced features more easily remains to be seen. I suspect that they might.
  • Visual Studio 2005 and SQL Server 2005
    They have been available for several months now, of course. If you've read my blog before, you'll know that I've been developing applications using Visual Studio 2005 for quite some time. Visual Studio is not without its problems (Service Pack, please...), but I believe that Microsoft is committed to fixing some of the problems they introduced (witness thereof the new Web Application Project and Web Deployment Project templates).
  • Atlas
    I don't buy into the Web 2.0 etc. hype. But, AJAX does offer benefits. I've been developing an application that requires a form to be completed in a number of steps; and within each step, the web server has to provide more data based on user selections. While regular ASP.NET can handle that just fine, refreshing entire (complex!) web pages versus just a few of the elements on them is very different. The user experience is enhanced significantly by allowing a page to be partially refreshed. Speed is one factor. I know the form inside out, and I can complete it in about 60 seconds with AJAX. It takes over 2 minutes if AJAX is not enabled. The difference: the web server response time.
    I don't recommend site designs that do not ever navigate to a new web page, because there are certainly many issues with that approach, including manageability and accessibility.
  • VOIP
    I recently switched to Voice over IP at home and in the office. I am impressed with the quality, the features and the price. However, using cable modem connections at both locations highlights one important point: Using QoS (Quality of Service) is absolutely necessary. Backups at the office are done over the Internet to a remote site, and these uploads take up most/all of the available uplink bandwidth. Having a phone conversation at the same time is impossible without bandwidth management.

I hope to be writing about these subjects more soon.

Sven Aelterman.

posted Monday, June 05, 2006 1:47 PM by SvenAelterman with 0 Comments

Difference between NUnit and Visual Studio Team System unit testing framework

While converting a project from VS.NET 2003 to Visual Studio 2005, I also converted the unit tests to the Visual Studio Team System unit testing framework. While I believe that the unit testing framework in VS 2005 has merits, I am not sure if I am ready to dump NUnit. NUnit has a major advantage over Visual Studio for the specific project I am working on: it can correctly compare the contents of arrays.

Suppose you have a custom class. In order to properly compare two instances, you override the Equals method. Both NUnit and Visual Studio Team System will use the Equals method in their respective Assert.AreEqual methods.

However, NUnit will compare arrays on an element-by-element basis, calling the Equals method on each element in the array. Visual Studio Team System expects you to iterate over the array and call Assert.AreEqual for each element (which I would think is what NUnit does under the covers (I haven't actually looked at the source code, but it seems to make sense)). If you supply two arrays to Visual Studio's Assert.AreEqual, then the unit test framework will consider the arrays equal if they refer to the same memory address (reference equality).

P.S.: There is one more difference that makes NUnit preferable in certain situations. NUnit introduces a concept of "Categories." Each unit test can be assigned to one or more categories. You can then elect to only run unit tests in a specific category, or exclude unit tests from a specific category. For a large project, or a project where you know under certain circumstances tests will fail, this is particularly attractive.

UPDATE: According to the documentation, the Team Edition for Testers (and therefore Team Suite) provides the notion of Test Lists, which allow logical groups of tests to be created. Sadly, this means developers have to pay extra for this functionality if they choose to use the Team System testing framework.

posted Monday, November 14, 2005 3:46 PM by SvenAelterman with 0 Comments

Conditional Build Events in Visual Studio 2005

A customer asked me if it was possible to create a post-build event in Visual Studio 2005 that would only be run if the active mode was "Debug."

A brief search in the Internet (using A9.com, to keep getting "a piece of the Π") revealed that there was no "built-in" support or any solution previously posted. However, the solution is rather simple, almost trivial. Build events are just commands that get passed to the command line interpreter (with some escaping taking place).

I remember that MS-DOS used to support IF statements for batch files. The Windows Server 2003 command interpreter (cmd.exe) still does, and this is the syntax:

IF [NOT] condition command

Type "help if" at the command prompt to see more information. IIRC, the MS-DOS IF statement was not nearly as extensive as the one supported by cmd.exe.

Combine this with the fact that the build events provide several "macros" (variables is what I would call them) that are replaced with values before the command is sent to the command line, and you get this command:

IF /I "$(ConfigurationName)" == "Debug" <command to run>

The /I switch makes the comparison case-insensitive. The quotes around the macro name are necessary in order to make the command interpreter see it as a string. <command to run> can be replaced with the command. If the command contains spaces, it must also be enclosed between quotes.

If you need to execute multiple commands for a single condition, there are two ways to achieve this: either repeat the IF statement on as many separate lines as you have conditional build events, or put them all in a batch file. The latter method would definitely be the preferred method. Note that you cannot put parentheses () around the multiple commands. In a batch file, each command must be and can be separated by a newline character. However, each build event must be separated from the next one by a newline character as well. There is an inherent conflict there.

posted Tuesday, November 01, 2005 6:18 PM by SvenAelterman with 0 Comments

Hosting HTTP web services without IIS

During my talk at the Alabama Code Camp, I demonstrated how you can host a soap web service in a WinForms application (or a Windows Service, etc.). However, my solution required the use of SOAP over TCP, which does make it less interoperable.

Angel Machin has a post that would allow any .NET application to host HTTP web services (using Web Services Enhancements). I have not tried this myself, but I got the link from William Stacey's blog.

William Stacey himself hasn't been idle either lately. He posted an improved custom solution to create a security context token on Channel 9. His first solution can be found on his blog and as a complete sample in my Alabama Code Camp downloads (Demo 2). I will probably change an implementation of web services I was working on to this SRP implementation. It is standards-based (which makes long-term maintenance, including maintenance by others) easier and promotes better security because the protocol has seen extensive reviews by the security community.

posted Sunday, October 30, 2005 2:35 PM by SvenAelterman with 0 Comments

Alabama Code Camp: Great Event

The Alabama Code Camp last Saturday was, from my perspective, a success. I thought that attendance was high and the quality of the sessions I attended good to very high. Thanks to the sponsors for enabling this (including a "free lunch").

The only side of the event I liked less was the venue. Computer classrooms are not the best places to sit and watch demonstrations. Also, the building is a complete maze and there are no pointers whatsoever to help you find a particular room number.

I believe people who came to my presentation were satisfied. Unfortunately, one hour was not nearly enough to show what I really wanted to show. My slides and the code for WSE 2.0 have been posted. I am working on an issue with one of the demos in WSE 3.0, but expect those files to be posted soon. I need to mention that the idea for Demo 2 in my presentation was obtained from William Stacey's blog.

Security Gaffe

One thing that is nearly as funny as this, is a poster I noticed at the Virginia College, Palisades II campus (where the Code Camp was held). The poster was meant to inform their students of the availability of a virtual library. As such, it was posted at the main entrance. Unfortunately, the poster included not only the URL to the virtual library, but also the password...

I wonder why they even bother to have a password then? (Note that I didn't actually try this out, and it's possible that the virtual library is only accessible through their student portal site, which probably requires a separate logon. Still, it makes no sense to have a secondary password then.)

posted Sunday, October 30, 2005 2:06 PM by SvenAelterman with 0 Comments

An improved Microsoft Excel color banding solution

Today, someone asked me if it was possible to make Excel highlight the column and the row of the cell that is selected. Excel already highlights the column and row header, but when working on a high-resolution screen, that does not help much in ensuring that you are actually entering data in the right cell.

I set out to find a solution, and on the Microsoft Office Assistance site, I found [1]. While this certainly works, it has a major drawback: any conditional formatting that is applied to any cell in your worksheet is lost. The worksheet for which this solution was needed didn't actually have any conditional formatting, but I figured that that might change and users would probably never figure out why their conditional formatting was always lost.

The problem with the solution at [1] is that it indiscriminately removes all conditional formatting in the worksheet. I figured that a better solution can be found if you merely keep track of the previously highlighted area. That way, you only need to undo the conditional formatting the macro applied, rather than all of it. In addition, the macro can be improved even further by only removing the conditional formatting that actually matches the conditional formatting it previously set. In other words, only delete the conditional formatting if the formula and the expression matches what the macro itself applies.

That conditional formatting is very simple, by the way. It merely applies a background color (which is guaranteed to be different from any background color the cell already has and from the font color in the cell) if the formula "TRUE" is True, which it always is, of course.

An additional improvement I made is that the last "banding" is removed before the workbook is closed. That way, when you open the workbook next time, there are no oddly highlighted cells. If that would happen anyway, the solution is simple of course: just put the cursor cell that was selected before the workbook was saved and then move it away from that cell.

Here's the VBA code that achieves this. Just copy and paste it in your workbook's ThisWorkbook VBA code.

Option Explicit

Private LastTarget As Range

Private Sub Workbook_BeforeClose(Cancel As Boolean)

    UndoBanding LastTarget
   
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal target As Range)

    ' Undo last target band coloring
    UndoBanding LastTarget
   
    ' Save the current target as the last target
    Set LastTarget = target
   
    ' Band color the current target
    DoBanding target
   
End Sub

Private Sub UndoBanding(ByVal target As Range)

    Dim c As Range
    Dim CurrentRow As Integer, CurrentColumn As Integer
    Dim i As Integer
   
    If (Not target Is Nothing) Then
        ' Undo in the actual target cell(s)
        If (target.Cells.Count = 1) Then
            UnBandCell target
        Else
            UnBandCell target.Cells(1, 1)
        End If
       
        ' Un-highlight the same column's cells above
        CurrentRow = target.Cells(1, 1).Row
        CurrentColumn = target.Cells(1, 1).Column
       
        For i = CurrentRow - 1 To 1 Step -1
            UnBandCell target.Worksheet.Cells(i, CurrentColumn)
        Next i
       
        ' Un-highlight the same row's cells to the left
        ' TODO: How about other cultures? (R-t-L)
        For i = CurrentColumn - 1 To 1 Step -1
            UnBandCell target.Worksheet.Cells(CurrentRow, i)
        Next i
    End If
   
End Sub

Private Sub DoBanding(ByVal target As Range)

    Dim HighlightColor As Variant
    Dim c As Range
    Dim CurrentRow As Integer, CurrentColumn As Integer
    Dim i As Integer
   
    If (Not target Is Nothing) Then
        HighlightColor = target.Interior.ColorIndex
       
        ' Ensure that a proper color is selected
        If (HighlightColor < 0) Then
            ' The default is light blue
            HighlightColor = 37
        Else
            ' Add 1 to the color index of the current cell
            HighlightColor = HighlightColor + 1
        End If
       
        ' Highlight the actual target cells
        If (target.Cells.Count = 1) Then
            BandCell target, HighlightColor
        Else
            BandCell target.Cells(1, 1), HighlightColor
        End If
       
        ' Highlight the same column's cells above
        CurrentRow = target.Cells(1, 1).Row
        CurrentColumn = target.Cells(1, 1).Column
       
        For i = CurrentRow - 1 To 1 Step -1
            BandCell target.Worksheet.Cells(i, CurrentColumn), HighlightColor
        Next i
       
        ' Highlight the same row's cells to the left
        ' TODO: How about other cultures? (R-t-L)
        For i = CurrentColumn - 1 To 1 Step -1
            BandCell target.Worksheet.Cells(CurrentRow, i), HighlightColor
        Next i
    End If
   
End Sub

Private Sub UnBandCell(ByVal cell As Range)

    Dim fc As FormatCondition
   
    If (Not cell Is Nothing) Then
        ' If this cell has any conditional formatting at all
        If (cell.FormatConditions.Count > 0) Then
            ' Find the conditional formatting this macro applied
            For Each fc In cell.FormatConditions
                ' This is based on the formula and the expression type
                ' Note: in the very unlikely case that someone actually has a use for
                ' this conditional formatting, it would be deleted also
                If (fc.Formula1 = "TRUE" And fc.Type = 2) Then
                    fc.Delete
                End If
            Next
        End If
    End If

End Sub

Private Sub BandCell(ByVal cell As Range, ByVal color As Variant)

    ' Ensure that the cell's background color is not the same as the color about to be applied
    If (color = cell.Interior.color) Then
        color = color + 1
    End If
   
    ' Ensure that the cell's font color is not the same as the color about to be applied
    If (color = cell.Font.color) Then
        color = color + 1
    End If
   
    ' If there are no conditional formattings applied yet
    If (cell.FormatConditions.Count = 0) Then
        ' Apply it
        cell.FormatConditions.Add xlExpression, , "TRUE"
        cell.FormatConditions(1).Interior.ColorIndex = color
    End If
   
End Sub

Not all is well with this solution. Because four loops have to be executed and conditional formatting is applied on a cell-by-cell basis, slower machines may experience a delay, especially the further away from the A:1 cell the cursor is positioned. Also, if it would so happen that all cells that would be highlighted by this macro already have conditional formatting applied, not a single cell will be highlighted. Of course, this does not cause any harm, but then again, the macro doesn't do anything to make the spreadsheet easier to use either.

[1]: http://office.microsoft.com/en-us/assistance/HA011366231033.aspx

posted Wednesday, October 05, 2005 2:36 PM by SvenAelterman with 0 Comments

Alabama Code Camp: October 29th Rated Excellent [5 out of 5].

Alabama .NET code community, if you were not already aware, mark your calendars: on October 29th, the first Alabama Code Camp will be held in Birmingham. It's an event for developers by developers, and registration is free (but required). You can find registration information, directions, and session listings at their web site.

I will be speaking about Web Services Enhancements 2.0 and 3.0 and specifically how those products can be used in real-world applications. I am developing a commercial application at this time that uses WSE 2.0 (and soon 3.0), so I will be able to provide some interesting insights.

I will post a link to my presentation and code downloads on my blog shortly after the Code Camp is over.

I hope to see you there!

posted Friday, September 30, 2005 8:39 AM by SvenAelterman with 0 Comments

Powered by Community Server, by Telligent Systems