Wednesday, May 18, 2005

More Windows Goodies

I have tried out a few new cool Windows features.

You can now make your status bar entry for your program flash using the Flash method.
In VB code Me.Flash(). One place this could come in handy is to notify a user when an asynchronous operation has completed, perhaps a Web service call or using one of the new asynchronous data retrieval techniques in ADO.NET 2.0.

Another cool feature is the new resource editor and the accessing of resources. Visual Studio 2005 really makes it easy to place strings, icons, images etc into a resource file as the resource editor has been vastly improved. Simply open project properties and select the Resource tab. The resource editor will appear. Icons and Images are now easily added as resource entries. For example, just select images from the Categories dropdown at the top of the resource editor. Then, drag an image (i.e. a BMP file) from the file explorer into the resource editor. Give it a name (i.e. pic1)

Also add a string entry; select String from the Categories dropdown and add an entry giving the string a name and value. Now the cool part, you only need one line of code to access the value or the image from the resource file. Suppose you added a resource string named test. In a code window, type something like:

Dim s as string = My.Resources.test ‘Access the string
Picturebox1.image = My.Resources.pic1 ‘Access the image

Resources are now available from My.Resources. This is also true for images, icons etc. This makes resource values even easier to use!!

0 Comments:

Post a Comment

<< Home