/Home /Archive /Syndicate /Blog /Support /About /Contact  
All Visual Basic Feeds in one place!





Channel: VB & .NET Blogs @ vbCity.com

SQL SELECT statements can do a lot more than just return individual records.  They can also summarize, compare, and combine.  This article is the first in a series of more advanced query concepts.  My examples use the AdventureWorks database, available here  . An aggregate function is a built-in summary over multiple records, for example SUM(), AVG(), MIN(), MAX().  The following statement gives the total of OrderQty using eve ... [ read more ]


In a recent article I talked about agile development, which favors short cycles of deliverables instead of major releases.  The agile model can be beneficial to many organizations, since it gets working software to the customer quickly and allows changing direction as a result of feedback. Unfortunately, the agile model doesn't work well if your product is, for example, Microsoft Windows, and you have hundreds of millions of customers.  This type of user community expe ... [ read more ]


In this instalment of a look into animations in Silverlight, animations using KeyFrames will be examined. The other animations that have been posted about ( DoubleAnimation , ColorAnimation , PointAnimation and MultipleAnimations ) have all been types of animations that use linear interpolation, changes occur smoothly and evenly over the time of the animation, when they are run. With KeyFrame animation you can have linear based keyframes, keyframes that use interpolation from one value ... [ read more ]


A typical requirement when dealing with a WinForms application is to notify the user that something has occurred within your application. This can be done in many different ways. Today I would like to show you how to make your Form flash in the Task Bar, and how to make the Window Caption flash as well. Start by creating a new Windows Forms Application and name it " FormFlash " Next add a New Module to the project called " FormFlashExtension " Replace the ... [ read more ]
In my last post I discussed how to create a Class Library (.dll) file for your Extension Methods. Here I would like to share some of my commonly used String and Date Extensions Imports System.Runtime.CompilerServices Imports System.Text.RegularExpressions Imports System.Security Public Module CommonExtensions <Extension()> _ Public Function IsEmailAddress(ByVal value As String) As Boolean Return Regex.IsMatch(value, "\w+([-+.']\w+)*@\w+([-.]\ ... [ read more ]
One of the cool new features in Visual Studio 2010 is the Chart control.  (A very similar control is available as a free download to work with Visual Studio 2008, but charting is now built into the 4.0 framework.  You can find the 2008 version here .)  The native support in 4.0 is a big help for ASP.NET developers, because we no longer need to worry about getting permission to install a DLL in shared server environments. Here's an e ... [ read more ]


If you've been in software development for a while, you've probably seen projects with one or more of these problems: A lot of long hours just before, and just after, a "go live". Last minute changes, introducing quality problems and personnel stress. Developers and business people are discouraged from talking with each other. Software is delivered according to specs, but it doesn't meet the actual business need. A few key developers are swamped, while mor ... [ read more ]


In my previous blog post I demonstrated how to add and IsNothing extension method to the .NET Framework Object class. Here's another extension method I regularly use:  IsInteger for the .NET Framework String class: <Extension()> _ Public Function IsInteger(ByVal argument As String) As Boolean Return Integer.TryParse(argument, Nothing) End Function dp.SyntaxHighlighter.ClipboardSwf = '/dp.SyntaxHighlighter/Scripts/clipboard.swf' dp.SyntaxHighlighter.Highligh ... [ read more ]


Extension methods were added to Visual Basic in 2008. I often use them in programs to add methods to .Net framework classes, for example to extend the Object class to include an 'IsNothing' method: Public Module ExtensionMethods <Extension()> _ Public Function IsNothing(ByVal obj As Object) Return If(obj Is Nothing, True, False) End Function End Module dp.SyntaxHighlighter.ClipboardSwf = '/dp.SyntaxHighlighter/Scripts/clipboard.s ... [ read more ]


This is Part 2 into a look at Extension Methods.  Part 1 covered the basics of Extensions, how they work with the compiler,  how to create and use them. This Part will cover the following Creating a Class Library (.dll) for your Extension Methods Referencing your Extension Library Using your Extension Library in a new Project 1.  Creating your own Extension Library. Start by creating a new Class Library called Extensio ... [ read more ]


I have updated the Silverlight Animation example page to include a multiple animation storyboard example which goes with this post . The multiple animation example works with two storyboards, one that will animate the height, width and colour of a rectangle and the second that animates the height, width, colour, startpoint and endpoint of a lineargradientbrush. You can find the example page here . Edit: I have been experiencing connectivity issues with the web server tha ... [ read more ]
This is the fourth part into a look at animations for Silverlight.  DoubleAnimations was the topic of part 1 , ColorAnimations were looked at in part 2 and PointAnimations were covered in part 3 . In each of the posts there was only one property that was animated, but what if the case arose that you wanted to animate more than one property at a time?  Can this be done?  The answer is multiple animations can be achieved as simply as single animations are done. The example ... [ read more ]


In the not-too-distant past, VB (and C#, etc.) programs routinely built SQL SELECT statements in code.  It was a straightforward, effective way of asking for a result set to meet the user's conditions.  Match some textboxes, create a WHERE clause, presto, you're done. I'll give my examples today in C#: string sql = "SELECT * FROM OrderDetail WHERE ProdType = '" + cboType.SelectedText + "'"; // take only future and not fully paid ... [ read more ]


I have updated the Silverlight Animation example page to include a PointAnimation example which goes along with this post . As with all the other examples I have made available, you can change some of the properties of the PointAnimation to see how the animation is affected. You can find the example page here .
This is part 3 into a look at Silverlight Animation.  Part 1 examined DoubleAnimation and in part 2 using a ColorAnimation was covered. This part will show how to use a PointAnimation. Just like the colouranimation, the pointanimation has many of the same properties as the doubleanimation.  The difference is the type of property of the element that is being targeted.   The pointanimation targets a property that uses a set of x and y coordinates as its value. T ... [ read more ]
I have updated the Silverlight Animation example page to include a ColorAnimation example which goes along with this post . As with all the other examples I have made available, you can change some of the properties of the ColorAnimation to see how the changes affect the animation. You can find the example page here . Edit: PointAnimation example added May 30th, 2010.
This is part 2 in a series of posts looking at Animation with Silverlight.  Part 1 of the series looked at the DoubleAnimation .  This post is going to cover the ColorAnimation. In many regards the ColorAnimation is similar to the DoubleAnimation.  In fact just about the only difference between the two is the type of property of the element they target.  DoubleAnimations can tartget several different properties, where the coloranimation can only target a colour.  Oth ... [ read more ]


I have working example of a Silverlight Animation to go along with this post . With the example you can set some of the properties of the DoubleAmination to see how the changes affect how the animation runs. You can find the example here . At the time of this post there is only the DoubleAnimation example available to view, but I will add more animations as I write posts for them. Edit: ColorAnimation example added May 29th, 2010. Edit: PointAnimation example added May30th, ... [ read more ]
This is the first post is a multi-part series taking a look at animations in Silverlight. Animations are used to apply effects for Silverlight elements.  Animation in silverlight is a way to change the value of an elements property over a set period of time. There are some limitations to silverlight animation however.  At time of writing this blog you can only alter properties which use a Double, Object, Colour or Point data types.  You also have no control over the frame rat ... [ read more ]


I have posted up a working example of Element to Element binding to go along with this post . The example is set up in the same fashion as the project in the blog post and can be found here . You are able to change the height and width of the Rectangle by either using the sliders or entering values into the TextBoxes.
Element binding is the process of setting up a relationship between the value of a property of one element to the property of another element. Once the properties are bound you can alter the properties of one element from the other. If you have been following this series on Beginning Silverlight, and visited the example pages for Brushes , Transforms  or Plane Projection  then you have seen element binding in action.  Very little code behind was used on any of the examples a ... [ read more ]


Over the last few years, SEO has grown into an expertise all its own.  Everyone wants their sites to be “SEO friendly”, or optimized for search engines. Until now, creating dynamic sites using ASP.Net web forms that were SEO friendly was a daunting and tedious task. Now, in ASP.Net 4.0 and the introduction of System.Web.Routing namespace, creating SEO friendly sites just became very easy. There is a lot of buzz around MVC, not a new concept, but new’ish to ASP. ... [ read more ]


I have posted up a working example of using a PlaneProjection on an Image to go along with the blog post .  You will be able to apply values to all 12 properties of the projection and see how they affect the image. The page with the working example can be found here .
In a way this could be a continuation of my look into transitions in Silverlight because what this post is going to cover is a perspective transform. Silverlight does not have a toolkit for 3-D drawing but this perspective transform gives you the opportunity to simulate 3-D.  Like the other transforms it takes the existing element and changes how it is drawn only this one makes it look like it is on a 3-D surface. 1.  Setting up the Project. For this project I have c ... [ read more ]


I have posted up some working examples of Transforms where you can change some of the properties of a Transform and see how they look and work to go along with the posts that I have done for RotateTransform , SkewTransform , ScaleTransform , TranslateTransform and the TransformGroup . The page with the working examples can be found here .
This is the last post in the look at transforms in Silverlight.  The first post looked at RotateTransform , the second SkewTransform , the third ScaleTransform and the fourth examined TranslateTransform . Each of the posts showed how to apply one transform to a silverlight element and you may be wondering if you can apply more than one transform to an element at a time. The answer to that is a definite yes, otherwise there would be no point to this post. 1.  Setting up the ... [ read more ]


This is the fourth post in the series of looking at Transforms in Silverlight.  The first post looked at RotateTransform , the second SkewTransform and the third examined ScaleTransform . This post will look at the easiest of the transforms the TranslateTransform. The TranslateTransform takes the element you apply it to and draws it in another position determined by a set of x and y coordinates. The transform is applied from a central point which is defaulted to 0 on the x- ... [ read more ]
Other posts in this series of a look at Silverlight transforms are RotateTransform and the SkewTransform . In this post I am going to take a look at the ScaleTransform. ScaleTransform is used to stretch or shrink an element either along its x-axis or y-axis. The transform is applied from a central point which is defaulted to 0 on the x-axis and 0 on the y-axis.  This default point is the top left of the element. 1.  Setting up the project. For this project I am st ... [ read more ]
I got to thinking that it would be a really good idea if I posted up some working examples of Brushes so anyone could change some of the properties of a Brush and see how they look and work to go along with the posts that I have done. The page can be found here . You can change properties of the LinearGradientBrush, RadialGradientBrush and ImageBrush as well as see a VideoBrush in action.


In the first part this look into transforms the RotateTransform was examined. This post is going to take a look at the SkewTransform. SkewTransform. The skewtransform basically takes any rectangular element and turns it into a parallagram.  The transform accomplishes this by skewing the value of either the x or y axis by a degree assigned when the transform is defined. Even though I say a rectangular element, this does not mean that non rectangular elements can’t have a s ... [ read more ]


Transforms are used to shift or alter the way an element is drawn.  These transforms include SkewTransform, ScaleTransform and TranslateTransform.  These transforms include SkewTransform, ScaleTransform and TranslateTransform. The first transform I am going to look at is RotateTransform. RotateTransform RotateTransform is used for the process of rotating an element to a certain angle around a central point. For this example I am starting with a button placed in the cent ... [ read more ]
Here is a simple tutorial on how to read, compile, and run code that is written in a text file. In this example, we will be reading properly formatted VB.NET code from a text file which will change the text of a TextBox in a Windows Forms application to "Hello vbCity!!" when a button is pressed. frmMain   Here is the code contained in the text file (Code.txt) . This file located in the project's bin directory (ensure you set it to "c ... [ read more ]


This post deals with the last two brushes that can be used in a Silverlight 3 project.  These are the ImageBrush and VideoBrush. Part 1 I took a look at the SolidColorBrush and the LinearGradientBrush.  Part 2 examined the RadialGradientBursh. ImageBrush The imagebrush takes an image and paints the element with that image.  You are not limited to using the two brushes described in this post only on fonts this is just how I decided to use them as an example. Any e ... [ read more ]
Visual Basic and C# are by far the two most popular .NET languages.  With the 2010 releases of both, Microsoft has announced the intention to keep them as even as possible, putting new features into both at the same time.  Both languages compile to the same intermediate language, and there are translators that can pretty much take code in one and turn it line by line into the other.  The decision to use one over the other is really a personal preference, not based ... [ read more ]


This is part two of a look into the different types of brushes that you can use with Silverlight. In part one I took a look at the SolidColorBrush and the LinearGradientBrush. In this post the RadialGradientBrush.  I was also going to take a look at the ImageBrush and the VideoBrush but due to the length of this post I will do a Brushes Part 3. 1.  The RadialGradientBrush. You would use the radialgradientbrush in much the same manner that you would a lineargradientbrush.&n ... [ read more ]


Brushes are what you use to give color to your applications. There are five types of brushes that you can use for colour in a Silverlight application.  There is the SolidColorBrush, LinearGradientBrush, RadialGradientBrush, ImageBrush and VideoBrush. In this first part of a three part look into brushes for Silverlight, I am going to look at the SolidColorBrush and LinearGradientBrush. For this example I have created a silverlight project that has a border in the middle of a grid. ... [ read more ]


Styles are used to create an individual look and feel to elements of an applications.  Each silverlight element has a series of attributes that you set to make a style for an element. For this example I have created a silverlight application with a grid to which I have added three rows and three columns.  I also set the background of the grid to light gray to make it stand out a little more.  Into the first cell of the grid I have declared a textbox. When the ... [ read more ]


In part one of Beginning Silverlight Layout I introduced the Grid as a base container control for the content of your application. In this post I am going to talk was originally going to only take a look at the Canvas and StackPanel container controls, but there is another control that I thought deserved to be mentioned as well.  The last container control I will look at is the ScrollViewer. 1.  The Canvas. The canvas is the simplest of the controls to use as a base containe ... [ read more ]


This is the first part of a two part look at controls for the layout of a Silverlight 3 application.  I originally planned on covering the layout control in one post but the Grid is complex enough to have its own post.  In the second post I will cover the Canvas and StackPanel. Silverlight UserControls and pages can only hold one element so you must first add a container control that will hold more than one control to create the user interface of your application. There are three ... [ read more ]


This post is a continuation of my previous Beginning Silverlight 3 (Visual Studio) and Beginning Silverlight 3 (Blend) posts and will deal with how to deploy a Silverlight 3 web application. I am only going to go over deploying a Silverlight 3 application in its simplest form.  The simplest form being an application hosted in a HTML web page. 1.  Building the application. Before you deploy your Silverlight application, you should build it to make sure that you are deployin ... [ read more ]


I wrote a post about creating a beginning Silverlight 3 Hello World application using Visual Studio and thought that writing a post for doing the same application with Expression Blend was a good idea as the two development platforms are different enough in their approach to creating applications. 1.  Intro to Silverlight and background. Silverlight is built on a sub-set of the Windows Presentation Foundation framework for providing a platform for developers to create web applicati ... [ read more ]


1.  Intro to Silverlight and background Silverlight is built on a sub-set of the Windows Presentation Foundation framework for providing a platform for developers to create web applications that can utilize multimedia, graphics, animations and user interactivity.  User interfaces are declared using Extensible Application Markup Language (XAML) with programming logic written in any .NET Language, for example VB.NET or C#, which allows development of Rich Interactive Applications (R ... [ read more ]
When I installed the Silverlight 3 tools for Visual Studio 2008.  Having developed a few Silverlight 2 projects with VS2008 I was interested moving to develop with Silverlight 3. The install of the tools was uneventful, but imagine my surprise when I created a Silverlight 3 project and all I could see was the XAML tab.  I really started to panic thinking that the tools install messed up Visual Studio and that I would either have to uninstall the Silverlight 3 tools or ... [ read more ]


Introduction This article is the first article in a series of articles I will be writing on Exception Handling and Exception Logging. Everyone tries to write applications that never fail and the truth is it can be done but it takes a lot of work. While this is not a comprehensive guide to writing fail proof programs it will however start you off in the right direction for logging Exceptions into an SQL Database. Is SQL Server Installed? If you a ... [ read more ]


I recently started looking into Code Access Security. Right away I began implementing the PrincipalPermissionAttribute to some of my methods to see how it all worked.  When I began testing some of these methods I found the following code did not work like I thought it would. <PrincipalPermission(SecurityAction.Demand, Authenticated:=True, Role:="Sales Rep")> _ <PrincipalPermission(SecurityAction.Demand, Authenticated:=True, Role:="M ... [ read more ]


I just finished reading " Grace Hopper and the Invention of the Information Age " by Kurt Heyer.  Grace Hopper is best known as the inventor of COBOL, but she is also one of the pioneers of programming in general.  Among her accomplishments are the compiler, the subroutine, and programming languages that are portable across hardware.  It's hard to overestimate her impact on software development as we know it today. Grace Hopper started her career in the navy, work ... [ read more ]


In this article we will take a look at Extension Methods.   We will learn how they work internally with the compiler, how to create them and how to use them.     So what exactly is an Extension Method?     Before the time of Extension Methods if you wanted to extend the functionality of an existing class, you had to either add the new code to the existing class and recompile, or create a new derived class and compile it. ... [ read more ]


You might think that a set of radio buttons behaves like a single control, and can be used interchangeably with a single-select ComboBox.  Often it can, however there is a slight difference that can trip you up. If you add a "CheckedChanged" event to all the buttons (or a single one that handles them all), you will find that the event code fires twice.  Checking a new button fires the change event for the new button, because it is now checked.  It also fires ... [ read more ]


If you go into a Visual Studio method and start typing "MessageBox", you get a pop-up with some helpful text like "Displays a message box with the specified text...".  As you pick one of the overloaded methods, the pop-up changes appropriately, and explains each field.  For example, it might show " Text: the text to display in the message box". You can have Visual Studio give you the same hints on your own methods by using ... [ read more ]


It’s no secret that many of the .NET Framework functions are built on top of the Windows APIs. A quick visit to www.pinvoke.net provides a quick glance at many of those functions and more. While numerous of these functions are built-in to the .NET Framework, some of the more interesting ones are left aside. Here we examine two functions provided by the Kernel32.dll. Wikipedia defines the Kernel32.dll as: “Exposes to applications most of the Win32 base APIs, such as memory management ... [ read more ]


Suppose we want to create a class or structure that represents an angle (of type double) between –360 and 360 degrees. Traditionally, we would create a new class or struct defining its behavior and initialize it with the “new” keyword. C# Angle myAngle = new Angle (23.4244);   VB.NET Dim myAngle As New Angle(23.4244)   However, sometimes it can be more intuitive if we can initialize the type by simply providing the ... [ read more ]


Intro to the GAC The global assembly cache (or GAC) is a location on your harddrive where Windows stores assemblies (.dll) that can be used by many applications. In fact, all of the .dlls used for .NET development are stored in the GAC and reference when added to a project (ie. Imports System.IO). The typical location of these files is " C:\WINDOWS\assembly ". You can navigate to these via Windows Explorer, however you cannot get a list of these assemblies simply by u ... [ read more ]


A few of us here at vbCity enjoy spending a bit of time taxing our brains in an attempt to solve math questions posted at http://projecteuler.net . I thought I would post my solutions to the first ten problems (for now). These small programming snippets where written in a great "Pythonish" .NET language called Boo. More information about the Boo language can be found here:  boo.codehaus.org/  . Boo is freely available and already supplied with the SharpDevelop I ... [ read more ]


I was planning this post anyway, when someone on the vbCity forums was looking for some very similar code.  She wanted to keep track of where the mouse cursor was, relative to the position on a PictureBox.  And then she wanted to position another visual element relative to the form.  This is sort of a screenshot, but for some reason it's missing the mouse cursor.  (It was just above the top left of the yellow box.) The visual element uses a Label contro ... [ read more ]


When you create a Windows form in Visual Studio, the FormBorderStyle property is set to a value of  Sizeable .  If you don't override this default, that means that a user can maximize the form, or drag a corner to make it grow and shrink.  Controls on the form keep their current location and size, so maximizing a small form reveals a large blank area, with the controls crowded in the top left.  Not ideal, although I'll be the first to admit that ... [ read more ]


In response to a question posted on the vbCity.com forums, this article explains the basics of programmatically entering data into text fields and "clicking" buttons presented on a webpage using the .NET Framework's WebBrowser control. These methods will vary depending on the website and may result in a bit of trail and error... but it wouldn't be fun if it were TOO easy. Steps: 1. Review the webpage First we need to take a look at the webpage we want to int ... [ read more ]


There are many folders that you could store files in, but if you pick one that is not valid for some reason, it will give you problems in some circumstances - particularly if the user running your program is not logged in to Windows as an administrator (from Vista onwards, they usually aren't). Where you should be storing the files depends on what those files are used for. Files for your program to just read from, and not write to If files are read-only and are only for use ... [ read more ]


I spent a lot of unnecessary time today tracking down a bug that wasn't there.  When I ran my program normally, it got the right answer.  Stepping through it in debug, it went wrong.  I couldn't understand it. The problem occurred in my custom class for representing fractions, because I had overridden the ToString() method.  My method called another method, Reduce() , which altered the contents of the class.  As a result, looking at inte ... [ read more ]


Recursion is a programming technique where a Sub or Function calls itself.  If that sounds like a recipe for endless looping, it certainly can be, and caution is needed whenever you design a recursive structure.  A recursive calculation typically performs an operation, then performs the same operation on the result, over and over, until the end condition is met. The standard example for recursion is the calculation of factorials.  In case you've forgotten, the fac ... [ read more ]


The most successful projects, software or otherwise, are the ones where everyone has a good idea of what they're doing and why. A healthy organization communicates its goals, successes and failures, and has well-informed employees. A really good illustration of the importance of communication is given by Nobel-winning physicist Richard Feynman in his lecture Los Alamos From Below .  (This lecture is also a chapter in his very entertaining autobiography, Surely You're Joki ... [ read more ]


I just got a note from Visual Basic MVP Steele Price, who pointed out a fourth way of writing XML.  Unlike the three in my last post, this method will not work in C#. As I should have mentioned, VB allows you to put XML directly in your code, which is great if you don't need to do a lot of dynamic modification to the XML.  Now with LINQ, you can also insert variables, using a syntax resembling Classic ASP. Since Steele was nice enough to send me a good example, I'll just p ... [ read more ]


I just got back from the "Code Camp" of the Boston .Net User Group.  It was a really good event, and I saw Joseph Anderson 's presentation about using LINQ and XML.  Basically, he talked about XElement and XDocument , which are new in .Net 3.5.  They're part of the LINQ namespace, and you can do some really interesting things with them. But I just want to talk about how they simplify writing an XML file.  I recently had occasion to do this, and I did ... [ read more ]


Visual Basic 2010 provides mechanisms to continue lines of a statment without the traditional _ (underline) character. One mechanism is to contiue the statement on a new line after a comma...... ...( read more )


Back to Sokoban, for the last time.  BTW, if you'd like a copy of the program, please go to my profile and send me an email. I used an icon editor ( IconSoft , written by vbCity Leader Richard Hare) to create six image files.  The images represent the empty white and green squares, the squares with the warehouse keeper, and the squares with boxes.  The file naming mirrors the numeric representation.  10 = empty square (not a target), 11 = n ... [ read more ]
  Visual Basic.NET has a lot of numeric types: Integer, Int16, Int32, Int64, Short, Long, UInteger, ULong, UInt32, Double, Decimal, Real, Float ...  It can get confusing.  I realize that there is already a lot of material on this topic, but it's been on my mind lately. Why are there so many types? Well, first of all, there aren't quite as many different ones as it seems.  Int64 and  Long are really the same, for example.  ... [ read more ]


I just have to rave about the performance of the Dictionary object.  I was trying to solve Euler Problem 87 , and my program was taking days to run.  Basically, I created three arrays (prime squares, prime cubes, prime fourth powers), then iterated through all three to see if any combination matched each of the 50,000,000 numbers. At first it wasn't so bad.  At low numbers, I could quickly determine that only a small number of fourth powers could be part of a total ... [ read more ]


If you like programming and you like math, take a look at Project Euler .  This is a website with over 250 questions that require serious computation, and you need to write a program to answer each one.  Many of the questions build on earlier questions, so you'll reuse your prime number tester, your test for palindromes (numbers that are the same backwards and forwards), etc.  If you can answer 25 questions, that gets you to "Level 1", which is more than 80% of th ... [ read more ]


Solving a Sokoban puzzle can require hundreds of moves.  As a Sokoban player, you may press a wrong key or simply use poor logic to get yourself into an undesirable position.  The program should allow you to "undo" one or several moves, rather than forcing you to start again.  Undo logic is typically implemented by using a " Stack ".  A stack is a " last in, first out " (or LIFO ) structure. For a visual, think of a Stack as a pile of plate ... [ read more ]


  I'm writing my own version of the game Sokoban.  My next few entries will describe some of the technical decisions, and talk about game programming in General. What is Sokoban? Sokoban is a Japanese word that means "warehouse man" (I think).  The game is about 20 years old, and I'm sure there are thousands of implementations around.  Basically, you move a man with arrow keys and try to push boxes into target areas.  Mine looks like this: ... [ read more ]
I have a number of Sokoban puzzles in a text file, in a format like this: > 1 TR XSokoban.dat 1     #####     #   #     #$  #   ###  $##   #  $ $ # ### # ## #   ###### #   # ## #####  ..# # $  $          ..# ##### ### #@##  ..#     #     #########     ####### You can d ... [ read more ]


As you may recall, the Sokoban board is an array of integers.  A value of zero indicates an unreachable space.  The other spaces can be normal (with a value of 10) or target (20).  Additionally, a valid space can be empty, or contain the man (1) or a box (5).  The value of a space is its base value plus its contents. I created a simple helper class to hold a set of coordinates. Class MPoint     Public X , Y As Int16  &n ... [ read more ]


 For a while now I knew that the WPF Expander control was going to be included for use with Silverlight 3. The official Silverlight site mentioned it more than once. I even found some blogs that showed using the Expander with Silverlight, but when the time came to insert an Expander into a new Silverlight project all the good feelings stopped. Error and assumption number 1: All the new Silverlight controls are not automatically included in the Visual Studio ToolBox. I am not sure ... [ read more ]


This was a rather interesting one that I only stumbled upon. Now that Silverlight 3 has been released, I figured it was time to update some web sites that I look after and get away from the plain HTML with CSS that I had been using. It took much less time that I thought to get the first site set out and running the way I wanted or so I thought. Most of the site content was put into a ScrollViewer as I knew it would extend past the bottom of the window and someone viewing the site would b ... [ read more ]


Recently I have been updating, or rather upgrading may be a better word, a few web sites that I have been looking after for years. I have been using some Javascript to blend images in a sort of slide show and decided that if I was going to change the web sites over to Silverlight 3.0 that it was as good as time as any to replace the decade old Javascript as well. I would like to say that I am so well versed in XAML that all I had to do was manually type in the required XAML to the Silverlig ... [ read more ]


 It seems like Hyperlinks are my main focus this week. Once I had gotten the Hyperlinks with Images working for my current project, I got to thinking about my next project and just what I could get Hyperlinks to look like.  It turns out that you could do just about anything you want to create a Hyperlink.  The only thing limiting you is your imagination though you may want to temper your imagination and not make anything too gaudy. I had a vague idea of what I wanted and one ... [ read more ]


 Continuing on the subject, and project, from my last post I will look at using an Image, as well as other WPF Elements, instead of plain boring Text as the visual for a Hyperlink on a WPF Page. The page in question will be viewed by the user in the web browser, in the instance of my application the browser will be IE6, which will link to external sites on the Internet.  We wanted to use the logo from the sites, sometimes with a caption under the logo, rather than just a textual lin ... [ read more ]


Either I am missing something or the information is just not out there in an obvious place. What I am talking about is deployment of Applications.  Windows, WPF, ASP.NET or Silverlight it all seems to be the same.  There is plenty of information about how to develop Applications but deployment seems to be a lacking topic. I was recently brought into a conversation about Silverlight 2 due to my interest in WPF and an application that I was developing for where I work.  The ... [ read more ]


If you're a C++ or VB programmer migrating to C# 2008, this book is well worth reading. The author, Daniel Solis offers a very visual approach – with lots of figures, diagrams and code samples – that will help you get to work with C# fast. The book is abolutely fantastic and it is FREE !!!   Get your free C# ebook here


TabControl with WPF and Visual Basic.NET 2008 Project Sometimes it just takes me a while, but I finally got to the point where I figured I should also be including the Visual Basic projects to go along with the posts and the videos. You can download the project that goes along with the TabControl with WPF and Visual Basic.NET 2008 post. The project can be downloaded from here . My apologies for the size of the file.  It is a little bloated because of having the video file. ... [ read more ]
TabControl with WPF and Visual Basic.NET 2008 A while back I posted up about showing more interesting content on that tab of a tab control using Windows Presentation Foundation (WPF). In the example that I posted, I created the custom look of the tab control just using XAML and I thought that it would be good to also show how to do the same thing using Visual Basic. To do this I decided to cut back to the basics for the content of the tabs and I started with a tab control with fou ... [ read more ]


Video for Gadget Window I have finished the video showing the process for creating a Gadget Style window. You can download it from here .  
Multi-Line commenting There are times when I have to wonder if I am the only person who does not know some things. I ran into this self doubt again the other day when I was watching one of Ron Cundiff's VB.NET Soup To Nuts WebCasts. During the WebCast one of the participants asked if there was a way to comment multiple lines of code.  When I heard this my ears perked up and I got very interested. In the, almost, ten years that I have been writing code, I always have com ... [ read more ]
ClickOnce Deployment – Deploying files with your application In a previous post , I showed you how you can deploy your application using ClickOnce.  Looking at how to deploy extra files, like my first look at ClickOnce, was prompted by a post on vbCity . Now I will admit that I wasn’t as sharp answering the original question as I could have been so be gentle with your opinion of me if you read through the thread.  (In fact it took me two days to work out that w ... [ read more ]
ClickOnce increments Rockford Lhotka posted up some details about how ClickOnce handles what is downloaded when it performs an incremental update.  The more I look at ClickOnce the more I am coming to appreciate it. I know this goes against the ClickOnce idea, but if the end user could only determine where the Application is installed.  I suppose if I want to be that fussy I would just distribute and install via a Windows Installer file.
Deploying applications with ClickOnce ClickOnce Deployment A recent post on vbCity regarding deploying an application with ClickOnce got me wondering about doing deployment with ClickOnce. I have always done deployment of applications by creating and using a Setup and Deployment package which created a .msi installer file, so it was interesting to see some of the differences between the two distribution methods. First off I created a simple application to test the ClickOnce dis ... [ read more ]
Text and Image for Button with Visual Studio 2005 Ok, let’s call this page 22,492 in the book of things I did not know about Visual Studio 2005. I was reading something the other day, if I can remember or find it I will post up a link, and was surprised that I had missed this little bit before.  (I have recently been reading “WPF for those who know Windows Forms” that can be found here   and watching webcasts by William Steele on his  WPF Soup ... [ read more ]
Video for WPF expander The companion video to my post on the expander control in WPF is now available for download. The video can be found here .
Video for tab control with WPF A couple of days later than I had planned, but I finished the video that is the companion of this post  about custom content in the tabs of a tab control in WPF. You can download the video here .  
WPF Expander Control There are a lot of neat options now available to us programmers thanks to WPF. One of these is the expander.  The expander is a control pretty much like a groupbox which can hold various controls.  The main difference between a groupbox and an expander is the controls in a groupbox are always visible where the expander gives the developer, and by extension the user, the ability to hide any controls and conserve valuable space on a windows form. As you ... [ read more ]
Drag and drop code to and from ToolBox Sara Ford blogged about this a couple of days ago and I thought it was a really cool feature of Visual Studio. She pointed out, what could be, a little known feature of Visual Studio.  You can highlight and then drag code snippets into the General tab of the toolbox. You will then fine the code as an item in the toolbox. If you want to see exactly what the code is all you need to do is hover your mouse over the item and the co ... [ read more ]
TabControl background colour video This is a follow up on the post about changing the colour of the TabPanel part of the tab control.  I created a video showing how I went about changing the template of the tab control using Expression Blend. You can download the video to watch from here .
Creating a Gadget style window with WPF and Visual Basic.NET 2008 I don’t know if it is a case of my actually knowing more or the fact that doing stuff with Windows Presentation Foundation (WPF) is easier.  To me it seems doing what I want is getting quicker these days. The ability to create and use semi-transparent forms has been around for a while now, but the process to creating these types of forms has not been the easiest. Visual Basic.NET 2005 gave us access to the o ... [ read more ]


ClickOnce deployment videos I have finished making videos showing how to deploy and update Applications using ClickOnce.  All the videos have been zipped so that you can download them and watch at your leisure. I orignally thought it was going to be in two parts, but decided in the long run to make it three parts to keep the length ove the video and size of the files down. Part 1 goes through the settings. Part 2 shows the publishing process as well as downloading and insta ... [ read more ]
WPF Expander control revisited I was taking another look at the WPF expander control that I talked about here and discovered that you don't actually need to use any code to get rid of the background colour of the control when collapsed. What I discovered is that if you set the VerticalAlignment of the expander control.  You can set this property to Bottom, Center, Stretch and Top.  All but Stretch will hide the background colour of the control when the control is colla ... [ read more ]
Drag and drop code to and from toolbox (part II) After posting up about this feature    of Visual Studio I got to messing around with it a bit. ( Sara Ford's post got me excited about this topic) I got to thinking that although it was a great idea to be about to store code snippets in the toolbox, I did get to thinking that it could get confusing having all sorts of code for different things in one tab and be able to separate the code in organized groups would be handy.&nb ... [ read more ]
TabControl with WPF After having looked at how to change the background colour of the tab header I got to wondering what else can be done to the tabs using WPF.In a very short time my question changed from “What can be done?” to “What can’t be done?” As was shown here by MVP Ged Mead you can easily set the background colour of the tabs on a tab control, and a solution to the setting the background of the header here . Those posts got me wondering jus ... [ read more ]
Property Search I was taking a look at working with a WPF application the other day when I found, what I thought, was a really neat feature of Visual Studio 2008. What I came across was the “Search” feature that is built into the Properties window of my WPF application.  It was quite by accident that I found the search ability because I could not find the property of a control that I was trying to change.  I knew the property existed, but for the life of me I could no ... [ read more ]
Writing Files In the previous post I talked about Reading Files. Now I will show you how to Write Files.   Writing to Files is as easy as Reading from Files. As with Reading Files you need to Import the System.IO Namespace.       1   Imports System.IO As with the StreamReader, writing with StreamWriter can be done in more than one way. How you Write to the File will also depend on if you want to Write to a New File, Overwrite and existing File ... [ read more ]
Reading Files Depending on your Project you could find yourself needing to read Files. One way that you can accomplish this is to use the StreamReader. StreamReader is part of the System.IO Namespace and you must add the Imports Statement to your Project before you can access the StreamReader. At the very top of your Form.vb code page, before anything else, you would type:       1   Imports System.IO Now your Project can access the System.IO Namespa ... [ read more ]
Looping through Controls   One of the things that I seem to find myself needing to do with each App that I write is at some point in time I will want to Loop trough the Controls on one of my Forms.  There are plenty of ways of doing this and this is how I ended up going about it. Chances are when you want to do this you will want to Loop through just one Type of Control to make sure that a certain condition is matched.  Let’s say, for instance, that we want to ma ... [ read more ]
It has been a while since I have posted up here and I am trying to get back into blogging. I thought I would start by posting up some of the posts from the old vbCity blog site ( http://blogs.vbcity.com/canoz/  (no guarantee the site will work if you click the link and hense the reason we have moved to the new Community Server site) and work up to some new blog posts.  Hopefully the info on the posts will still be found to be of use.
Setting the TabPanel background colour A question came up in the vbCity Forums that I participate in about changing the background colour of the header portion of the TabControl.  The original question was about changing the colour of the tabs themselves ( original question ). vbCity Leader (and Microsoft MVP) Ged Mead  posted up code to change the colour of the tabs, but once the tab control's DrawMode property was set to “OwnerDrawFixed” the portio ... [ read more ]


 (Note:  As you will be able to tell this is an old post, but the information in it is still relevant today.) Having installed Visual Studio 2005 on my computer the other day I took the plunge and looked at some of the new features.  One of the first thing I came across was the My Namespace.  Oh what a difference from VB6.  Gathering information about your Computer, User, Applicaiton and so much more is now very simple.   Gone is the day of needing line after ... [ read more ]


Most recently I’ve been working on a project using Developer Express controls and i am taking this moment to write a brief review about it. I will not recite the feature list because it’s boring and tedious so here we go. Many of you have probably experienced the frustration of not having ideas for how to develop one of those attractive GUI’s. We all have seen some great applications with good GUI but, developing an application that has a “sexy” GUI is the har ... [ read more ]


Although you can create an application without using these features they are often very useful making it easier to visualize and work with the classes....( read more )


Most recently i answered a question on vbcity.com about getting craigslist's RSS feed with RDF: So i thought it would be fine if i share the code with the other people who need something like that. Ok here we go.         Dim XMLDoc As System.Xml.XmlDocument = New System.Xml.XmlDocument         XMLDoc.Load( "http://newyork.craigslist.org/cpg/index.rss" )         Dim nTable As NameTable = XMLDoc.NameTable         Dim nsManager As XmlNa ... [ read more ]


Copied from old Blog April 2007 Every now & then I would get the first time launch message appearing when I was starting up VS 2005, which wasted lots of time & I finally got around to googling a solution. It turned out that it was a problem with using roaming profiles ( I switch between virtual machines quite often for various development requirements which I thinks what causes it) & I found the solutions in this MSDN article But I'll post it here as well for ... [ read more ]
Extension methods are new in Visual Basic 2008.  This short blog series explores how extension methods can be used to add Subs and Functions to the .NET String type. Click here for an index of this blog series. Here's this post's sample code: Module StringExtensions     ' Declare a String extension method named Browse     '   that uses the string assigned to a variable of type String as a url  & ... [ read more ]


Copied from old Blog from Dec 2006 I had the need the other day for a way of displaying a list of site users on an InfoPath form that the user can select from and came across this article on Jan Tielens' blog which I thought would do the trick. Unfortunately it was for SharePoint 2003 rather than 2007 so I had to play around a bit to get it working, & came up with 2 methods of accompishing it which I wanted to share with you. Create a New Visual Studio .Net project based on the Info ... [ read more ]


Ever get frustrated when looking at a SharePoint calendar and for a particular month you've clicked expand all then move to a different   month and find that you're back in collapsed view. Well you can change this by making some modifications to the CORE.JS file but keep in mind that you migh t have to redo this customization following any SharePoint service packs that you might apply. There's basically 2 functions  ... [ read more ]


  Copied from old Blog March 2008 Well it's been a long time since my last post and I though I'd better get my arse into gear and share some of the stuff I've been working on. As part of some development work I was doing for a colored SharePoint Calendar I had the need to allow users to select colors to have different types of Events displayed in and couldn't find a decent way of accomplishing this with the built in components of SharePoint, so I decided that this wa ... [ read more ]


VIsual Basic contains some useful functions not available in the .NET class library. This post is about one of those functions, the Right(str,length) function. The Visual Basic 'Right' function is useful when you need to get 1 or more characters from the right side of a string. It returns a string containing a specified number of characters from the right side of a string. Syntax:  Right(str,length) Parameters str Required. String expression from ... [ read more ]


 This is not my own work but something I picked up from a post a came across on MSDN that I thought would be useful, so i thought I'd blog it here so i knew where to find it in the future. . Credit for this goes to Elizabeth Elizondo . All you need to do is add this after the PlaceHolderTopNavBar ContentPlaceHolder then tweak it to your requirements. < asp:ContentPlaceHolder ID ="Sublinks" runat ="server" >    < SharePoint:As ... [ read more ]


I recently had a task to create code to calculate an annuity payment. Visual Basic has a builit in function - Pmt - for this purpose. Here's a method I created that calculates an annuity payment with Visua Basic's Pmt function: Public Function CalculateAnnuityPayment( ByVal rate As Double , _         ByVal paymentPeriods As Double , _         ByVal presentValue As ... [ read more ]


ANTS Profiler version 4.0, released September 2008, adds many new features to this already powerful .NET profiling product. Web: www.red-gate.com Phone: +1 866.733.4283 Price: $395/$495 Pro Quick Facts: ANTS Profiler is a tool for profiling applications written in any of the languages supported by the .NET framework. ANTS Profiler profiles all .NET applications, including ASP.NET web applications, Windows Services and COM+ applications. This is the third time ... [ read more ]


 Extension methods are new in Visual Basic 2008.  This short blog series explores how extension methods can be used to add Subs and Functions to the .NET String type. Click here for an index of this blog series. Here's this post's sample code: Module StringExtensions     ' Declare a String extension method named Browse     '   that uses the string assigned to a variable of type String as a url &nb ... [ read more ]


Extension methods are new in Visual Basic 2008.  This short blog series will explore how extension methods can be used to add Subs and Functions to the .NET String type. Click here for an index of this blog series. Try this: 1. Create a Visual Basic 2008 Windows Forms project. 2. Add a module named StringExtensions to a Visual Basic 2008 Windows Forms project:     2. To Form1 in the project add a form load handler based on this sample code: P ... [ read more ]
 When I first published this list on my .Net Resources blog October 2007, it contained eleven books. The list has grown so large that I am now hosting it on my Get Dot Net Code web site: Visual Studio 2008 Books


"The Silverlight Toolkit is a collection of Silverlight controls, components and utilities made available outside the normal Silverlight release cycle. It adds new functionality quickly for designers and developers, and provides the community an efficient way to help shape product development by contributing ideas and bug reports. This first release includes full source code, unit tests, samples and documentation for 12 new controls covering charting, styling, layout, and user input." ... [ read more ]


I've been thinking a lot lately about the difference between software construction and software remodeling, and how agile software development must vary for construction vs. remodeling.  Software construction is building version 1 of a software or system. Software remodeling is maintaining, refactoring, or adding features to an already constructed software application or system. (For brevity I will refer to a sofware application or system as jus ... [ read more ]


Visual Basic 2008 introduces anonymous types which enable you to create an object without declaring its data type.  Notice in the anonoymous type declaration below that there is no 'As' in the declaration to specify a type for the object it will create. user = New With {.FirstName = "Mike" , .LastName = "McIntyre" , .City = "Cobb" } When the declaration is compiled, the compile ... [ read more ]
 Another change announced at PDC 2008, and a seriously great improvement, to Visual Basic in the next version is the end of the requirement of the line continuation character.  You all know the one that I mean.  The underscore character ( _ ) that we have used for years to put our long lines of code on multiple lines.      Public Sub DoIt( ByVal opt1 As String , ByVal opt2 As String , _         &nb ... [ read more ]


 So just what is coming to Visual Basic with the next version? The short answer is Lots! Announced at PDC 2008, one aspect that is coming, and one that I am looking forward to, is auto-implemented properties. Just what is that?  Gone are the days where you have to hard code in a getter and setter for custom properties in Classes. As it stands now you would have: Private m_someField As String       Public Property someField() As String ... [ read more ]
Collection initializers will let you initialize collections with fewer lines of code. In the two examples below notice the use of 'From' to initial collections from lists. Dim colorList As New List(Of String) From {"Red", "Blue", "Green","Black"}  Dim statusDictionary As New Dictionary(Of String, Integer) From {{"Aproved", 1}, {"Disapped", 2},{"Needs More Info", ... [ read more ]
Access previous posts at:  http://blogs.vbcity.com/mcintyre/


Here's  an updated version of my PeoplePicker filling script that now uses the position of the  people picker rather than the field name to allow you to fill multiple people pickers easily.   <script type= "text/javascript" > _spBodyOnLoadFunctionNames. push ( "fillDefaultValues" ); function fillDefaultValues() {     //fill the  first people picture  fillPeoplePickerWithCurrentUser(1);   //fill th esecond people picker ... [ read more ]


It is a little longer than I expected to get the the project that goes along with this post about background colours in WPF but as they say better late .... The project can be downloaded from here .
I got caught the other day with a "what the heck" moment. I was trying to display "Mr & Mrs" as an Item in a ComboBox but it just was not happening. I suppose that this would not have come to light if my computer was not slowing down when I opened the ItemCollection window in Visual Studio.  It was so slow that I would type something then have to wait for a couple of seconds to show what I had typed.  If I made a mistake I had to change it which would take more time, so I deci ... [ read more ]


 I got caught the other day with a "what the heck" moment. I was trying to display "Mr & Mrs" as an Item in a ComboBox but it just was not happening. I suppose that this would not have come to light if my computer was not slowing down when I opened the ItemCollection window in Visual Studio.  It was so slow that I would type something then have to wait for a couple of seconds to show what I had typed.  If I made a mistake I had to change it which would ... [ read more ]


Example:   ' Create a LINQ query.         Dim buttonQuery = From control In Me .Controls Where TypeOf (control) Is Button         ' Create a list of object.         Dim buttonList = buttonQuery.ToList         ' Iterate through the objects in buttonList.      ... [ read more ]
My makes it easy to use .Net. Here's an example that uses My to rename a file: Syntax: Public Shared Sub RenameFile ( _     file As String , _     newName As String _ ) file is the file path to the file to be renamed. newName is the new name (with file extentsion) to be given to the file. Example: My .Computer.FileSystem.RenameFile( "C:\OldName.txt" , "NewName.txt" )   Mike McIntyre Get Dot Net Code ... [ read more ]


I have just discovered the most compelling reason to port over any projects I have to Windows Presentation Foundataion (WPF) as well as only starting new projects as a WPF project. The reason you ask?  Well the answer is one word. Printing Being a File I/O guy, printing has almost always needed to be a part of most projects that I have written so this is a really big thing for me.  Looking back printing with Visual Basic.NET was painful for me at times especially if the docu ... [ read more ]


vbCity Leader (and Microsoft MVP) Ged Mead showed how to create a FlowDocument in his article  published on devCity.com. I got the challenge recently to display a data inserted in a table in a flowdocument.  So I embarked on my quest. I knew that what I wanted could be done because some quick testing with XAML I was easily able to add a table to my flowdocument. Which gives an output like the following. My challenge, however, was that I needed to be able to do this ... [ read more ]
Once again it seems that I had what I thought was a great idea only to find out that someone else had it before I did. I don’t even know how I got to thinking about ToolTips and how boring they look, but I did and that got me to wondering what could be accomplished with Windows Presentation Foundation (WPF). What I eventually ended up with was using a Border which I would create custom messages in and display when the mouse was hovered over the object that the ToolTip was for. A ... [ read more ]


Once again it seems that a post from vbCity is to be fodder for a post here. Although not part of the original query by vbcity member quicksun, the question of getting a Windows Presentation Foundation (WPF) Form to be resized as the expander control was either expanded or collapsed came up. I went with what I thought was the quickest way about resizing the Form and that was to use the Collapse and Expand events of the expander control to reset the height of the WPF Form to its desired si ... [ read more ]


I mentioned in an earlier post that for a control in a Windows Presentation Foundation (WPF) application that you had to give each control that you wanted to write code behind for a name in the XAML of the form. Strictly this is not true.  If you want don’t want to use the built in features of the Visual Studio’s IDE for selecting classes and methods on the code behind page you could type in the code on the code behind yourself. For me, at least, the easiest way to reach ... [ read more ]
I don't think I will ever get over just how much easier it is to do some things in a Windows Presentation Foundation (WPF) application than it is in a Windows application. I was messing around with changing the background colour of a button to see what could be done.  I ended up looking at how to apply a gradient to be the background of a button and realized that doing gradients with Visual Basic was just about as easy, if not easier, than creating them by modifying XAML markup.  (Y ... [ read more ]


I have uploaded the project showing how to do all the Tab content which I posted in this post . The project can be downloaded from here .


When I last visited the TabControl project, I changed it so that the look of the Tab content was done via VB.  One thing that has been niggling at me since was how the first Tab content was done. The content on the Tab was still entered on the XAML code and the spans were defined there as well so the look could was not really created purely with VB.  Since I was after creating the look with VB, the first Tab also be included with this rather than a mixture of XAML and VB. I did fi ... [ read more ]


I have uploaded the project for the Gadget Style Window with one minor change.  Beethoven is out and a small midi file has replaced it.  I know that some of you are probably saddened as I am by Beethoven's departure, but I didn't want to subject everyone to a 30Mb+ download. The project can be downloaded from here .


I have made the project that goes with the post for the TabControl with WPF  available for download. The project can be downloaded from here . Again I must apologise for the file size.  Like the project for the Visual Basic.NET version  of the TabControl it is a little bloated due to the video file.


Sometimes it just takes me a while, but I finally got to the point where I figured I should also be including the Visual Basic projects to go along with the posts and the videos. You can download the project that goes along with the TabControl with WPF and Visual Basic.NET 2008 post. The project can be downloaded from here . My apologies for the size of the file.  It is a little bloated because of having the video file.
A while back I posted up about showing more interesting content on that tab of a tab control using Windows Presentation Foundation (WPF). In the example that I posted, I created the custom look of the tab control just using XAML and I thought that it would be good to also show how to do the same thing using Visual Basic. To do this I decided to cut back to the basics for the content of the tabs and I started with a tab control with four tabs.  The first tab had a textblock with some ... [ read more ]


I have finished the video showing the process for creating a Gadget Style window. You can download it from here .


I don’t know if it is a case of my actually knowing more or the fact that doing stuff with Windows Presentation Foundation (WPF) is easier.  To me it seems doing what I want is getting quicker these days. The ability to create and use semi-transparent forms has been around for a while now, but the process to creating these types of forms has not been the easiest. Visual Basic.NET 2005 gave us access to the opacity property of a Windows form.  The down side of this was that i ... [ read more ]


Looking at the browser stats for my main blog, Wonko's World , it seems that the newly released Firefox 3 is proving pretty popular - 124 visitors have used Firefox 3 so far despite the first release candidate being available for only a month. By way of comparison, only 88 people have visited using Opera since I started using eXTReMe Tracking 6 weeks ago, 199 used AOHell 9 and 216 used Safari. I also had 4 visits from a Playstation 3. Which is nice. I've downloaded Firefox 3 to give it a ... [ read more ]


Summary: Provides an overview of generics, constraints and their implementation.   Generics in Visual Basics 2005 make it possible to re-use code and still have strong typing.   With Visual Basics 2003 a different collection had to be defined for each data-type causing repetition of code. Generics allows for classes and methods to facilitate unrelated types. A major benefit of Generics is that one collection can be created to handle all data-types needed, thus cutting the am ... [ read more ]


There are times when I have to wonder if I am the only person who does not know some things. I ran into this self doubt again the other day when I was watching one of Ron Cundiff's VB.NET Soup To Nuts WebCasts. During the WebCast one of the participants asked if there was a way to comment multiple lines of code.  When I heard this my ears perked up and I got very interested. In the, almost, ten years that I have been writing code, I always have commented out any lines of code I di ... [ read more ]
In a previous post , I showed you how you can deploy your application using ClickOnce.  Looking at how to deploy extra files, like my first look at ClickOnce, was prompted by a post on vbCity . Now I will admit that I wasn’t as sharp answering the original question as I could have been so be gentle with your opinion of me if you read through the thread.  (In fact it took me two days to work out that when the person asking mentioned the "Publish" tab that they meant ClickOnce ... [ read more ]


Rockford Lhotka posted up some details about how ClickOnce handles what is downloaded when it performs an incremental update.  The more I look at ClickOnce the more I am coming to appreciate it. I know this goes against the ClickOnce idea, but if the end user could only determine where the Application is installed.  I suppose if I want to be that fussy I would just distribute and install via a Windows Installer file.


I have finished making videos showing how to deploy and update Applications using ClickOnce.  All the videos have been zipped so that you can download them and watch at your leisure. I orignally thought it was going to be in two parts, but decided in the long run to make it three parts to keep the length ove the video and size of the files down. Part 1 goes through the settings. Part 2 shows the publishing process as well as downloading and installing. Part 3 shows how ClickO ... [ read more ]


ClickOnce Deployment A recent post on vbCity regarding deploying an application with ClickOnce got me wondering about doing deployment with ClickOnce. I have always done deployment of applications by creating and using a Setup and Deployment package which created a .msi installer file, so it was interesting to see some of the differences between the two distribution methods. First off I created a simple application to test the ClickOnce distribution and installation method with.  ... [ read more ]


Visual Web Gui is an open source product for porting .NET Windows Forms applications to the web.  It is used to create ASP.NET web applications with a very AJAX like experience - without the AJAX programming hassle. It may be worth it to you to give it a try. Though it's little rough around the edges at this point, this product can be used today to produce web applications from .NET Windows Forms projects. And - the developer is rapidly improving the product each mo ... [ read more ]


Ok, let’s call this page 22,492 in the book of things I did not know about Visual Studio 2005. I was reading something the other day, if I can remember or find it I will post up a link, and was surprised that I had missed this little bit before.  (I have recently been reading “WPF for those who know Windows Forms” that can be found here   and watching webcasts by William Steele on his  WPF Soup To Nuts  series so it could have could have come ... [ read more ]


The companion video to my post on the expander control in WPF is now available for download. The video can be found here .


I was taking another look at the WPF expander control that I talked about here and discovered that you don't actually need to use any code to get rid of the background colour of the control when collapsed. What I discovered is that if you set the VerticalAlignment of the expander control.  You can set this property to Bottom, Center, Stretch and Top.  All but Stretch will hide the background colour of the control when the control is collapsed. Here is the revised XAML markup for ... [ read more ]


A couple of days later than I had planned, but I finished the video that is the companion of this post  about custom content in the tabs of a tab control in WPF. You can download the video here .


After posting up about this feature    of Visual Studio I got to messing around with it a bit. ( Sara Ford's post got me excited about this topic) I got to thinking that although it was a great idea to be about to store code snippets in the toolbox, I did get to thinking that it could get confusing having all sorts of code for different things in one tab and be able to separate the code in organized groups would be handy.  Well guess what.  It can be done. If you right ... [ read more ]
There are a lot of neat options now available to us programmers thanks to WPF. One of these is the expander.  The expander is a control pretty much like a groupbox which can hold various controls.  The main difference between a groupbox and an expander is the controls in a groupbox are always visible where the expander gives the developer, and by extension the user, the ability to hide any controls and conserve valuable space on a windows form. As you can see in the image below, t ... [ read more ]


Sara Ford blogged about this a couple of days ago and I thought it was a really cool feature of Visual Studio. She pointed out, what could be, a little known feature of Visual Studio.  You can highlight and then drag code snippets into the General tab of the toolbox. You will then fine the code as an item in the toolbox. If you want to see exactly what the code is all you need to do is hover your mouse over the item and the code will be displayed. I think that this ... [ read more ]


After having looked at how to change the background colour of the tab header I got to wondering what else can be done to the tabs using WPF.In a very short time my question changed from “What can be done?” to “What can’t be done?” As was shown here by MVP Ged Mead you can easily set the background colour of the tabs on a tab control, and a solution to the setting the background of the header here . Those posts got me wondering just what else could be done wi ... [ read more ]


I found this great POST  by the SharePoint Designer team for “Using Javascript to Manipulate a List Form Field”.  Unfortunately it didn't work very well for People Picker fields which is exactly what I needed to do today. After some trial and error, and a bit of head scratching I finally came up with the follow which I thought I'd share, since when I was searching for a solution I found a lot of people in a similar situation with no solution posted. =0 && i ... [ read more ]


This is a follow up on the post about changing the colour of the TabPanel part of the tab control.  I created a video showing how I went about changing the template of the tab control using Expression Blend. You can download the video to watch from here .


A question came up in the vbCity Forums that I participate in about changing the background colour of the header portion of the TabControl.  The original question was about changing the colour of the tabs themselves ( original question ). vbCity Leader (and Microsoft MVP) Ged Mead  posted up code to change the colour of the tabs, but once the tab control's DrawMode property was set to “OwnerDrawFixed” the portion of the tab control without button changed to the ... [ read more ]


I was taking a look at working with a WPF application the other day when I found, what I thought, was a really neat feature of Visual Studio 2008. What I came across was the “Search” feature that is built into the Properties window of my WPF application.  It was quite by accident that I found the search ability because I could not find the property of a control that I was trying to change.  I knew the property existed, but for the life of me I could not find it.  I ... [ read more ]


Source Code: http://blogs.vbcity.com/hotdog/archive/2008/02/22/8983.aspx Many times I've found it useful to have a process give feedback information to find out if everything was performing as wanted. And also one should be able to visualize, save and/or mail that information if wanted. Often you only want to show the information under certain conditions (an error occured, but you want to show the entire feedback) The classes contained here: http://blogs.vbcity.com/hotdog/archive/2008/0 ... [ read more ]
=0 && i h)ch.style.height=h;" sel=1 selold=1 selcount=3> Code Copy Hide Scroll Full using System; using System.Collections; using System.Collections.Generic; using System.Drawing; using System.Text; using System.Windows.Forms; using System.ComponentModel; using System.IO; using Subro.Exceptions; namespace Subro.Interaction { /// <summary> /// A single feedback item. A feedback item can provide information /// on status, progress and datetimes ... [ read more ]


I have only just recently had the time to play with the new features available in VS 2008 and one of the first things that I thought I would take a look at were Extension Methods. In a nutshell, extension methods allow you to attach a method onto any .NET type and utilise that method as if it was part of the type out of the box. If you consider the String type, there are many methods attached to the String type that allow you to retrieve it's length, convert the string to upper or lower c ... [ read more ]
I am not sure if this is old hat or not, but I regularly use the Copy Source As HTML addin in Visual Studio 2005 to post nicely formatted code samples. However, I have now got a new laptop loaded with Vista and VS 2008 and to my horror, my old install package of this great tool would not install as I did not have VS 2005 installed. I checked out Google and saw a number of articles that explained how you can get your VS 2005 addins to work with VS 2008 but they seemed like a bit of an ... [ read more ]


Article can be found here: http://blogs.vbcity.com/hotdog/articles/8858.aspx The new Linq functionality is great and easy to use. Enough tutorials exist on how to use the Linq syntax and on both DLinq and XLinq as well. However when you want to implement your own Linq source, pickings are slim. The ones that are available use the IQueryable interface. However, before that interface and seemingly at the heart of Linq is the 'Query Expression Pattern' In the following article the basics o ... [ read more ]


the System.DirectoryServices namespace from .net allready contains a lot of build in functionality for use with Active Directory. However some default task have to coded manually still. Of course that meant writing some support tools which I've been happilly using for some time now :) The code posted here are the base classes used for those tools. At a later time if anyone is interested I'll include the tools project too (simple LDAP browser, user form that can lock/unlock, set pw and mail ... [ read more ]


I have recently been trimming down View State from some pages in an ASP.NET application and was looking around for tools that could help me decide where the majority of the View State was coming from. I have found some Gems and figured I would list them here in one place:     ASP.NET ViewState Helper Homepage   This application can be downloaded either as a seperate Windows Application or as a Fiddler extension and is by far the better tool that ... [ read more ]


Every now & then I would get the first time launch message appearing when I was starting up VS 2005, which wasted lots of time & I finally got around to googling a solution. It turned out that it was a problem with using roaming profiles ( I switch between virtual machines quite often for various development requirements which I thinks what causes it) & I found the solutions in this MSDN article But I'll post it here as well for future reference When any one of th ... [ read more ]


Another one? Yep, I'm afraid it is just that: another date time picker control. I was using the default datetimepicker provided in the .net framework and liked a lot of its default features, but, like others, came upon some issues that made the dayly use of  it unacceptable for the target audience.  The control itself is very simple, the .net 2.0 maskededitbox does most of the work, but the way the format is handled makes sure the input can take any part entered (eg only mo ... [ read more ]


This class is a wrapper round an oledb connection to FoxPro. Don't know if there's much need for one, but I've had need for it on several occasions allready ;-) FoxPro needs a set of specific tweaks to make it work with the default bindings and especially if you want to update, simply using the default data adapter won't work out of the box. The class uses the default .net OleDB providers, but the machine the code is used on will need to have the FoxPro provider installed. The VFPOLEDB can be d ... [ read more ]


Having got past the last hurdle I then had a need for getting a list of all the site users into a Drop Down list which has spawned this second article


I had the need the other day to get hold of a users full name within a web hosted InfoPath form and although I could easily get hold of the login name I couldn't get hold of the users full name. After some playing around I came up with the method I describe in this article  which I hope someone else will find useful  


In short: the continuous control is a control that in the designer can take any control (or multiple controls) and when bound to a bindingsource shows it as list of that entity of controls. Those having used access know the concept as a subform. Click here for the source code: http://blogs.vbcity.com/hotdog/archive/2006/10/26/6567.aspx (last update 6/12/06) For a Step by step quick example guide, click here (The quick quickversion: add this control to a form, add a binding ... [ read more ]


The title was what this class was mainly created for. It's a small wrapper that extends the System.IO.DriveInfo, mainly with the purpose of setting the drive mappings.   =0 && i h)ch.style.height=h;" sel=1 selold=1 selcount=3> Code Copy Hide Scroll Full namespace Subro.IO { using System; using System.Collections.Generic; using System.Text; using io = System.IO; using System.Runtime.InteropServices; using System.Diagnostics; using System.Drawing; /// <su ... [ read more ]


I have been experiencing a bit of a problem with Visual Studio 2005 lately which has had me perplexed for some time. When I create a new Windows or Console Application, Visual Studio goes through its motions and I am presented with either the forms designer or the standard module based on the type of project I chose. However, as soon as I hit the F5 button (no code modifications made) the project builds and then does absolutely nothing. The strange thing is that my main Web Site project is not ... [ read more ]


Just threw together a quick tutorial (under the Game Development article section) on animated sprites using XNA Game Studio Express. It's so much fun to work with I should be paying Microsoft (but it's all free!) :)
So I've been playing with GSE for a couple days (I got off to a late start as I went on vacation the day after it was released) and I'm loving it. Why? The GSE team has made it ridiculously easy to get an XNA app running, basically a couple of clicks. Let's see: Fire up C# 2005 Express Click the Create Project link on the Start Page Select Windows Game (XNA) and give it a title Click OK That's it - 4 steps. Granted, it's not Half-Life 3, but there's a ton of stuff that g ... [ read more ]


If you do you'll be able to, starting August 30th. Microsoft recently announced XNA Game Studio Express. Bookmark the XNA Homepage . Read the XNA FAQ . You'll find a link in the first item to register to be notified when the download is available. Be sure to visit the forums Stay tuned here for the adventures of getting a game developed and running using XNA GS. It should be fun and interesting.




For starters, I should mention I'm not what you'd call an experienced PowerPoint user. But like most, I use it now and then. The things you can do with it are great too, but I just couldn't find an easy way to relink url's of movie objects. Relative didn't seem to be possible unless the movies were in the same folder as the presentation itself. Googling seems to indicate that PP always links to absolute paths, with no option to turn to relative and besides that: couldn't even find a way to ch ... [ read more ]


I am currently working on converting my Companies website from Classic ASP and ASP.NET 1.1 to ASP.NET 2.0. We originally started converting most of our Administrative products from Classic ASP to ASP.NET 1.1 and this went very smoothly and worked fine. The reason we chose the Administrative products first is that it was less risky as users would not be faced with any code that may be broken and it is easier to talk with our staff than it is with clients in relation to technical problems. ... [ read more ]


Another small class with nothing fancy or advanced, but that could spare time in not having to do it yourself ;-) .net has a lot of nifty debugging features. For Runtime support a lot of  convenient code exists in the System.Diagnostics namespace. But.. if you're anything like me, you use the Console.Write and WriteLine functions when developing. (when sometimes I really should use the Debug.Write... functions, but find it too convenient to use Console) Or.. other times when written fo ... [ read more ]


Well, I must have spent about an hour today trying to figure out something that I assumed would be pretty trivial, in fact it was in the end but you know how it goes. I was creating a simple registration page for a website which requires that the user agrees to the Terms and Conditions of the site before they can submit their registration details. To begin with, I had a check box that the user would have to tick in order to state that they agreed and only when this check box was checked wo ... [ read more ]


I recently downloaded the previews of the tools in Microsoft® Expression® : http://www.microsoft.com/products/expression/en/default.mspx While I've only spent a couple of minutes with the two products (Interactive Designer and Web Designer) I have to say I'm pretty impressed. Get ready for a HUGE learning curve to get up to speed with how interfaces will work in Vista (and here I haven't even got up to speed with the 2.0 version of the Framework! :( ). I'm sure I'll be ... [ read more ]


This may be old hat to some, but I only found out about this neat little feature of VS 2005 yesterday and thought it was absolutely the best thing since sliced bread. When you are debugging your code and you want to see the contents of a DataSet or a DataTable, one way is to use the Immediate Window and start entering commands such as "?myDataTable.Rows(0)(0).ToString" to read the first field in the first row etc. at least this is the way that I have been debugging programs in the past. ... [ read more ]


It seems MS is focusing more on game development using .NET. The announcement of the XNA Framework at the GDC and this new area of their site: http://g.msn.com/0AD0002U/887211.1??PID=3114334&UIT=A&TargetID=1063739&AN=304237415&PG=CMSAN1 Will the industry shift to .NET as a major language in game development? Hopefully, but I'm not expecting it soon. The (supposed) speed issue, (supposed) lack of penetration of .NET on client machines, etc. seem to be holding it back. ... [ read more ]


There was an interesting question in a Microsoft newsgroup - can one create Remote Assistance requests programmatically? As it turns out, the answer is yes, and the API to use is called “PC Health SDK”. It is a COM API, so even though I am unaware of any managed code solution, one can easily consume the PC Health SDK functionality by building their own interop assembly.


For the description of most controls we use labels and I for one don't like to add a label manually for each control. Been using a component that paints values, but never got around to put it in a nice coat and with design time support up until now. The design time being the most work (although greatly alleviated by finding out how to use the isComplete parameter of the InstanceDescriptor ;-) ), the component is easy in use and deployment. Usage: drop it to your form (or container control) and ... [ read more ]
This is just a summary of how I overlooked this silly little thing that could have made my designer workings so much easier in the past: how to use the InstanceDescriptor (returned by a TypeConverter) to create a variable inside InitializeComponent and set the properties of that variable, instead of having to set everything inside the constructor. All that was needed, is to set that last parameter (isComplete) to false. It's so incredible simple and effective, I still can't believe how I  ... [ read more ]


Visual Studio .NET 2003's Windows Forms designer can do better than world's best magicians - it can make controls disappear from a form without any apparent reason. Anyone expecting it not to turn the development process to a magic show should read these KB articles: http://support.microsoft.com/kb/842706/en-us http://support.microsoft.com/kb/818220/en-us http://support.microsoft.com/kb/911952/en-us http://support.microsoft.com/kb/322730/en-us


My home computer's mouse practically died several days ago. And while I am quite busy to go out and buy a new one, I still have to use my home PC, so my only choice is to use the keyboard. It was not until now when I felt what a great job Microsoft did to enable keyboard support. While I still feel somewhat awkward without the mouse, I nevertheless can access all the features I need in Windows, Outlook and Word. However, certain 3 rd party applications and Web sites are a different s ... [ read more ]


Just ran in a very odd problem using VB6.  My ability to add a “Class Module” is missing!     Turns out all I needed to do was go into Customize toolbar and reset all the toolbars and they came back


I was doing a research on a COM interop question posted in microsoft.public.dotnet.framework.interop newsgroup. COM interop is known to be somewhat arcane knowledge, and MSDN seems to give only the very basics. However, there's this guy Aravind C who wrote a very detailed article on COM interop, and I recommend this article to anyone dealing with such bridging “in the trenches“: http://www.codeproject.com/dotnet/cominterop.asp There's another nice presentation on the same ... [ read more ]


There are two alternatives when one needs to update a data grid's data source: By setting the DataSource (and probably the DataMember ) properties' values. By using the SetDataBinding method. In my experience, the latter is the right way. It just looks like the SetDataBinding method fully updates the grid's state, while just setting the properties does not trigger the complete internal state update sequence.


HTML Help Workshop has an unreasonable limitation - it won't allow you to add anything but HTML files as the topic files. And it does not always recognize files of other types being referenced from an HTML topic. Hence, the workaround is to edit the .hhp file manually and to add the desired topic files to the list. The .hhp files are just plain text files resembling INI files, so the editing is a piece of cake.
I wouldn't say that bridging non-visual .NET and COM components is an easy task, but at least this one is quite well documented nowadays. However, sometimes one needs to plug in a piece of UI developed in VB6 into a .NET client (or vice versa). Well, I do know this is not a recommended scenario and a bad design practice. But if only all applcations we deal with were designed properly... the world would be a much better place! But since we leave in the real world, it's gonna cost us some sw ... [ read more ]


I was helping out a colleague with a nasty ASP .NET problem the other day. The problem we were dealing with was related to an application pool that became irresponsive once in a while. The system event log indicated some problems, but we couldn't figure out how the events logged were related to the problem itself - as usual, the event descriptions were less than helpful. At that time, the only thing I could suggest was looking up Google groups and the MS KB for any articles that coul ... [ read more ]


After spending countless hours trying to figure out how to upload and download files using FtpWebRequest and FtpWebResponse I was playing around with the “snippets” and found one line statements in order to upload and download files.  ' Upload File My . Computer . Network . UploadFile ( "c:\myfile.txt" , "ftp://hostname/myfile2.txt" , "user" , "pass" ) ' Download File My . Computer . Network . DownloadFile ( "ftp://hostname/myfile2.txt" ... [ read more ]


I've been seeing a lot of posts in the vbCity forums lately about working with the client area of an MDI form. What's not immediately obvious is that the client area is actually an MdiClient control for the forms that are children of the MDI form (not the controls you put on an MDI form. They go into the form's Controls collection). One question I saw was asking how to change the backcolor of the client area. Doing: Me.BackColor = Color.Red doesn't work since it changes the B ... [ read more ]


Ok, so I think I'm going to start using this blog to discuss TopCoder Competitions.  Single Round Match 295, which was on Wednesday, was pretty fun, although I'm a little disappointed that I only got the first problem.  My rating went up nonetheless. So, you can view the first problem here , (you have to be logged in, sorry) basically the idea was that you were trying to build a bridge of D length with cards of L length and you had to return the amount of cards necessary ... [ read more ]
Often, mostly for designers, I want to get a list of available types. Mostly specific types and from all Assemblies. Had multiple code functions for that and that multiple times, because for different projects I tended to rewrite them (argh? yes argh ). But... now I decided to just storm ahead and create some default functionality. Why, that's easy, I can almost hear you say. Just use Assembly.GetTypes.... Right....Some issues there: I want all referenced assemblies as well and, it shoul ... [ read more ]


All code highlighting was done by SourceFormatX Class: zsocket : Header | Html Author: Mark, the Great and Powerful Date of Creation: 9/2/05 Last Update: 3/11/06 Library Dependencies: Ws2_32.lib zsocket is a handy class that I created that handles tcp communication similarily to the WinSock control. I implemented “events” (error, statechange, connectionrequest, and dataarrival) by having the client code inherit the zsocket class and override these methods. (You don't hav ... [ read more ]
I am Mark, the Great and Powerful 1 , revered and feared throughout the great blue nowhere. I am Mark Gordon, 17 years old, and currently attending Churchill High School in Michigan.  I am part of the Math, Science, and Computers program that my school runs which makes everyday... uh...  interesting.  Whether it be hopscotch on the desks 2  in the computers room, or dancing to moskau 3  (projecting the movie on a wall of course), we try to have fun. As far as programming goes, I started o ... [ read more ]


Check out the latest MS PR event for .NET - Made In Express Contest


We have an intranet at work (yes really :D) And we generally trust its contents. So it would be preferrable if we could just drop a .net application and run it. All righty then: we have to set the local intranet to fulltrust. Didn't work :shock:  To make a long version of trial and error short: unless enterprise level security contains fulltrust on either all_code or on the proper zone (intranet, a trusted zone or both), the machinelevel settings will not be used, and vice versa. I still d ... [ read more ]


Wanted to have a wrapper around the drag and drop outlook attachments for the File Select Control , but that turned somewhat harder than expected. Saving one attachment was easy enough. It could be done completely managed (found some other examples that do the same on the net), but saving multiple wasn't to be found in .net (at least not as far as I could find :-/) and even though the File Select control doesn't support multiple files (yet), the wrapper certainly should :p The problem i ... [ read more ]


There are many times when you need to display a large amount of data to a user. When this need arises, you could of course use a DataGrid and make use of the in-built paging mechanism which makes paging a breeze. However, what if you can't use a DataGrid? Maybe the data you are displaying does not fit the structure of a DataGrid. Fortunately, we can borrow the DataGrid's paging mechanism and use it to create our own paging control which will allow us to add paging capabilities to a wider range o ... [ read more ]


Well, having spent the last few days trying to migrate our website from Classic ASP and ASP.NET 1.1 to ASP.NET 2.0, I had just about given up. A little background. The website I am talking of was written using classic ASP and is the backbone of the company I work for. Now, this website, does not actually need to be upgraded in order to suceed but the development costs and turnaround times of new features would be better served by using ASP.NET. So, about eight months ago, we decided to write al ... [ read more ]


I found a pretty good example while browsing through some technical blogs on the web. As of late, with the migration to ASP.NET 2.0, I've found that using javascript with Master Pages, it a real pain in the... well you know. At any rate here is the link to the example. Master Page & Javascript Example


The .net framework of course has the openfiledialog and savefiledialog components build in which do all the rough work. Also the AutoComplete source in .net 2.0 makes it very easy to use the file system as an auto complete source. However, manually assigning those each time, adding a button to browse, etc. got a bit tiresome. Hence time for a little control. The class below is a simple control that uses autocompletion and/or a browsebutton to get input for a file (with the option to switch betw ... [ read more ]


I was looking at the ListView control in VS 2005 today and noticed the new addition of the ListViewGroup object. I didn't immediately know what this was but intellisense's tooltip states that it "Represents a group of items displayed within a ListView control" and this was enough to peak my interest (I'm easily pleased). For those like myself that are unaware of what a ListView group is, the following screen shot from Windows Explorer shows ListViewGroup's in action: Example of the Li ... [ read more ]


 Microsoft UK are running a competition with the aim of  showcasing the vision, creativity and dedication of the IT community in the UK .   This competition is split into two distinct categories:   Category 1:  IT professionals are invited to submit a deployed or aspirational system design, appropriate for any size of organisation, either in the commercial or not for profit sectors. The system design submitted should no ... [ read more ]
One thing I see often in the vbCity forums is “How can I make < some control > do this” or “I wish < some control > had < some property >”. One of the best things about .NET is that just about anything can be inherited. Want to add a Tag property to a control that for some reason doesn't have it. No problem: Public Class EControl     Inherits OldControl     Private _tag As String     Public ... [ read more ]


I've been desperately searching for news on when the creators of NDoc where going to release the version that is compatible with the 2.0 framework. While I don't think it is fully functional for the new types like generics, I did find a link with the binaries that will at least allow you to create documentation for apps and assemblies created with the 2.0 framework. It can be found here. The bottom response is the link to the binaries.


See the bottom of this post if you just want to see a quick solution ;-) What's this about? The new .net 2.0 datagridview is a great control and implementing custom columns is very easy, but doing so has a tricky setback: inherited fields and properties are not persisted. I'm sure this little oversight is something that will be mended soon enough, but it in the meantime the only solution seems to be to override the clone functionality. Don't know why precisely, but in the backg ... [ read more ]


I have finally started to look into Visual Studio 2005 in more detail today and something caught my attention on the start page. It was a link to an MSDN TV clip that introduces you to the My.Blogs object that has been created for use with Visual Studio 2005. This object allows you to add blogging capabilities directly into your Windows and ASP.NET projects and also demonstrates how you can extend the My namespace. I have downloaded the sample code but I had a little trouble installing the ... [ read more ]


Another old (and disappointing) project, was to quickly compress strings a bit, by not using the complete ascii range and certainly not the whole unicode range. At first I used this class to save a forms typename as an identifier, using 6 bits per letter. Besides being a bit gratifying in completing the puzzle, the usefullness of this class is... well.... let's say... not so very great. Right now I'm using it for a quick serializer where the use of it on cummalative typenames can make some ... [ read more ]
A division of Lucent reckons they'll have a 300Gb "holodisc" on sale this year. The name "holodisc" isn't really accurate but in a nutshell, this is how it works: On a normal disc (CD or DVD), the data is burnt as a series of pits in the surface of the disc representing 1's and 0's.  On the new "holodisc", the data is written at various levels inside the disc itself.  A CD or DVD drive can only write one layer of the disc but the new drives will feature lasers that can vary their ... [ read more ]
Was looking for some old code in an unfinished project and stumbled upon some code that I meant to publish, but don´t believe I did :-/ It's a simple component to quickly save properties of a form and/or controls on it. A bit obsolete now because the application settings in .net 2.0 are build in and can be used as is, and with a larger scope. The truth is: I don't even use this component, but use the application settings instead :rolleyes: Ah well, for those that are interested in s ... [ read more ]


Late last year my company provided our IT team with a weeks training in Object Orientated programming and design. Much of the course was taken up with UML and methodologies but the final day was more focused on actual programming concepts (which I enjoyed the most). The tutor was a really nice guy and was happy to answer any questions (I guess at a £1,000 a day, I'd answer anybody's questions). As our IT department is relatively small (4 members) the tutor advised us to follow the SCRUM ... [ read more ]


Well, I finally plucked up the courage to give blogging a go, with a little motivation from Ged ;) So what can you expect from this blog? To be honest, I'm not too sure about that myself. Since I was 18 I have always worked for companies developing Windows software (using VB) but now coming up to the ripe old age of 30 (shudder) I have spent the last year working solely on ASP.NET applications. So I guess, you can expect a number of entries to be related to my struggles/successes with web deve ... [ read more ]


Minor rant time: < rant > Every day I see questions on boards like: "When I tried to run my app, I get an < error type here > error. Can you tell me what's wrong?" To anyone who's done programming for any length of time, usually the only way to answer this question is with other questions: What line of code caused the error? Did you try stepping through the code to see what might have caused the error? Why don't you have error handling code in your app? I'm ... [ read more ]


I just posted an article on using the new Generics functionality in VS 2005. You can check it out here - http://blogs.vbcity.com/machaira/articles/5781.aspx


With ADO(.Net) it´s very easy to query Excel workbooks and with ADO.Net you get a DataTable with nicely typed columns (if possible). By default, the first row is treated as the header row. All this is done by ADO.net, nothing to add there, but... Since I have this nack of using wrappers around such things, here's one to quickly import files: =0 && i h)ch.style.height=h;" sel=1 selold=1 selcount=3> Code Copy Hide Scroll Full using System; using System.Coll ... [ read more ]


As my primary hobby development in .NET and gaming, I'm always on the lookout for something that makes the development easier. One such thing I've been checking out a bit is Tray Games . It's basically a platform and delivery method for small .NET games. They provide the API for doing client server development and host the games. It's still very early in development, but if you're into .NET game development and are looking for a way to get your games out there and tools to make your games mul ... [ read more ]


So I've joined the ranks of the vbCity bloggers. Hopefully you'll find something interesting and/or useful here. I'll probably concentrate my posting on game development as it's my favorite hobby. You might even stumble across some tidbits about the games I'm working on from time to time. If you haven't already done so, you might want to download the latest version of Microsoft's DirectX SDK (Dec 05 9.0c at the time of this post). Here's some of the cool things (well, to me at least ... [ read more ]


When exceptions are generated, you have some great debugging abilities in .net, but sometimes you want to save or mail those exceptions. For example batch programs can mail you their exceptions. The default stacktrace doesn't really cut it for me. You have to find your way back through the system methods before getting to the interesting parts. Besides that, I want to be able to see all inner exceptions as well without further actions. The ExceptionInfo class below can return Except ... [ read more ]


(First introduced here: http://blogs.vbcity.com/hotdog/archive/2004/09/11/280.aspx  , ) This is the second version of the AutoFormatter. Mainly intended for easily posting code blocks to .. let's say a blog, it can also be used for rtf conversion in general. DOWNLOAD /INSTALL Run exe (22-1-2006) The other options all want to access the internet to check for updates. Download or run this exe to use a version that does not try to do so. That also means of course t ... [ read more ]


Very simplistic perhaps, but something that keeps reoccuring for me in reporting needs: calculating the times a certain day comes back in a date range, so to find it back posted it here ;-) vb.net :      Function NumberOfDays( ByVal Day As DayOfWeek, ByVal DateFrom As DateTime, ByVal DateTo As DateTime) As Integer          Dim N As Integer         N = Math.Ceiling((Dat ... [ read more ]


MessageQueue: wrapper to show info messages in their own thread. Right now 2 simple modes are included: modal mode and outlookstyle. The latter scrolling up the message from the bottom right corner. The modal style really only is in for some backward compatibility in another project, but the scroll up mode is the main goal. It's a simple way to show more or less important messages without interrupting the main program or to show messages received from a server. As it is build now the message pu ... [ read more ]
Autostart is a little class to simplify setting your C# or vb.net application in the windows startup queue. Either per registry or in the program files startup folder. Nothing spectaculair, but I always misplaced my code of the registry key so decided to put it into a class up here ;-) The class definition: =0 && i h)ch.style.height=h;" selold="0" sel="0" selcount="2"> Code Copy Scroll Full namespace Subro { using Microsoft.Win32; using System.Windows.Fo ... [ read more ]


It has been along time since I have posted. It has been extremely busy since my last post with school and of course the friendly hurricane Katrina. I will post some pictures from Katrina when I finally get a chance. I am glad to say that I am about to publish my first article. It has been an extremely long process. I have learned a great deal about how to write an article and what readers actually look for in an article. Oh well, enough with the boring details in a few days I will be ... [ read more ]


In the previous post I talked about Reading Files.   Now I will show you how to Write Files.   Writing to Files is as easy as Reading from Files.   As with Reading Files you need to Import the System.IO Namespace.   Imports System.IO   As with the StreamReader, writing with StreamWriter can be done in more than one way.   How you Write to the File will also depend on if you want to Write to a New File, O ... [ read more ]
Depending on your Project you could find yourself needing to read Files.   One way that you can accomplish this is to use the StreamReader.   StreamReader is part of the System.IO Namespace and you must add the Imports Statement to your Project before you can access the StreamReader.   At the very top of your Form.vb code page, before anything else, you would type:   Imports System.IO   Now your Project can access the System.IO Namespace.   (Admi ... [ read more ]


Looping through Controls   One of the things that I seem to find myself needing to do with each App that I write is at some point in time I will want to Loop trough the Controls on one of my Forms.     There are plenty of ways of doing this and this is how I ended up going about it.   Chances are when you want to do this you will want to Loop through just one Type of Control to make sure that a certain condition is matched.   Let’s say, ... [ read more ]
I figure that it is about time that I started using my Blog as a place where others can perhaps learn something about programming with Visual Basic and Visual Basic.NET.  So here goes.   My, Oh My Having installed Visual Studio 2005 on my computer the other day I took the plunge and looked at some of the new features.   One of the first things I came across was the My Namespace.   Oh what a difference from VB6.   Gathering information about your com ... [ read more ]


Perhaps I've missed the option completely, but I didn't see a way to simply bind a group of radiobuttons to a datasource, hence this little control. It is a very very simple control inherited from groupbox that keeps track of the radiobuttons added to it. After that, the SelectedIndex can be set to select a specific control. That's also the property of course that can be used for the databinding h)o.style.height=h;" sel="1" selold="1"> Code Copy Hide Scroll Full   &n ... [ read more ]


I installed a "skin/patch" to make XP look like Vista. The best word I can find to describe it is "pretty". Anyone else tried it?


In a System.Windows.Forms.Control and anything that inherits from it, you have a nifty DesignMode property. Only this property is only filled when it has been created, so it can't be used in a custom control's constructor. Also sometimes you want to set readonly (static/shared) properties or fields to a value depending on the design or live environment (eg, a sqlconnection-string is mapped to the design database when run from designer and to the production dbase otherwise) For a lot of these ... [ read more ]


Smart tags are a great new option in whidbey. They make setting the default options of a control a lot quicker to do. It took me a little while to find the howto, since I was following google to msdn2, but I do believe that domain has been obsolete for quite some time now :D The winfx.msdn contained an excellent howto however which tells all the steps needed : http://winfx.msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_fxdeveloping/html/42cc4a0c-9ab3-47e1-93b8-03b6a6ccf233.asp ... [ read more ]


Just a very small control that shows the image centered, but with an additional Angle property (in degrees) that shows the original image rotated. The control doesn't posess much code, but after a question on vbcity  about such a thing, it seems that there's mainly some longer functions with the more difficult task of rotating an image itself (you need some math to calculate the new bounds then) This lightweight tidbit is just to show how little code is needed in the great ... [ read more ]


A very simple picture viewer. Needed a quick little something that could run slide shows for my wife (to show off her nail art ;-) ) and since it was for a non XP windows version, couldn't use the build in screen saver. Decided to make something rather than using possible existing similar applications, because well, I'm just strange that way and wanna keep my own source code for none build in items :-D While busy on it anyway, made it so it remembers the added folders and runs through all tho ... [ read more ]


Ok, so it's a bit lame but it's my first VB.NET application and I made it all by myself (with a little help from Ged 's cSFX class  to make it play a wav file). The application is a simple stopwatch and alarm.  It's all self-explanatory, no instructions needed. You can run it from here and download it from here .


© 2005 Serge Baranovsky. All rights reserved.
All feed content is property of original publisher. Designated trademarks and brands are the property of their respective owners.

This site is maintained by SubMain(), a division of vbCity.com, LLC