Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » VB   (RSS)

You can use Visual Studio to debug itself!

How do you find out why your computer or a running program is so slow? Here’s one way. Let’s attach the VS debugger to VS itself. The main executable for VS is devenv.exe. Start Visual Studio 2008. This will be the “debugger” Choose File->Open Project
Posted by Calvin_Hsia | 2 Comments
Filed under: , ,

Stack overflow, expand your stack? Change your algorithm!

In the last post, Area fill algorithm: crayons and coloring book , I showed a program that emulates a kid drawing in a coloring book. However, the algorithm wasn’t very efficient, and would explode even if you had a simple drawing: it was using the stack
Posted by Calvin_Hsia | 1 Comments
Filed under: , ,

Area fill algorithm: crayons and coloring book

Kids know how to use crayons and a coloring book. How do you write such a program? In my last post ( Which pixels do you turn on when you draw a line? ) I showed how to draw a line. Now suppose you have some lines or shapes already drawn. How would you
Posted by Calvin_Hsia | 4 Comments
Filed under: , ,

Which pixels do you turn on when you draw a line?

When I wrote my cartoon animation program almost 30 years ago (see Cartoon animation program ) I needed to know how to draw a line. Of course, nowadays, we just call a library function that will draw a line given two points. If you think about it, the
Posted by Calvin_Hsia | 3 Comments
Filed under: , ,

Comment/Uncomment code to switch versions quickly without using macros

In a typical day, I write or debug programs in several languages: typically Foxpro, C#, VB, C++ and 32 bit assembly, with an occasional MSIL, IDL and 64 bit ASM thrown in. Sometimes, I like to switch between one version of code and another. This is useful

Cartoon animation program

A cartoon can be thought of as a series of drawings. To simulate movement, the drawings can be slightly different from each other. Remember drawing simple cartoons using a pad of paper? Simply flipping through the pages made the drawings come to life.
Posted by Calvin_Hsia | 15 Comments

Write simple Debug helpers to help you debug and maintain your code

Much of my time is spent using the Visual Studio debugger examining code to figure out how it works and how to fix it. When stepping through a function, the values the function uses are very useful for code understanding. The debugger shows these values
Posted by Calvin_Hsia | 3 Comments

You can use HWndHost to host a Win32 HWnd window inside a WPF element

Suppose you have some old code lying around that creates a Win32 window with an HWnd (perhaps ATL , MFC , or just C/ C++). For example, if you type some erroneous code into a VB application in Visual Studio: Dim x=4: catch ex As Exception The “Exception”
Posted by Calvin_Hsia | 1 Comments
Filed under: , ,

Dynamically load a DLL from a runtime specified path

When running VB.Net or C# code, often it’s useful to call native code. One way is using PInvoke. (for other ways, see How fast is interop code? ) For example, you can call GetWindowText to get the title of a window. To get it’s managed signature, you
Posted by Calvin_Hsia | 0 Comments
Filed under: ,

Synchronize your files across machines with Mesh

I have a collection of almost 30,000 pictures and videos. When I add new pictures to the collection, I had been running a script file to synchronize the collection across various machines. for %%s in (\\calvinh6\e$ \\calvinh3\e$ \\calvinh4\e$) do ( robocopy
Posted by Calvin_Hsia | 13 Comments
Filed under: , ,

Magnify your pictures using a PictureBox so that you can zoom with the Mouse Wheel

Today’s digital cameras take pictures with much higher resolution than many computer screens. My Canon PowerShot SD800 IS camera takes pictures at 3072 x 2204 resolution. One of my laptops died recently, and I noticed that local laptop retailers have
Posted by Calvin_Hsia | 15 Comments
Filed under: , ,

Make your code more maintainable: The evils of the Return statement

What does it mean to make code more maintainable? Certainly obfuscated code is hard to understand, by definition. A big part of maintainability is making it easier for others to read and understand what the code is doing. Your code may have been working

A WPF version of the Typing Tutor game

In my prior post I show a Windows Form version of the typing tutor game. Here is a WPF version. Start Visual Studio 2008. Choose File->New->Project->VB->WPF Application. Dbl-Click the form in the designer to open the code window. Paste in
Posted by Calvin_Hsia | 2 Comments
Filed under: ,

The VB WinForm version of the typing tutor game

In this post, Create your own typing tutor! is code to create a game for learning the letters of the keyboard by typing the letters that fly across the screen. As times goes by, they fly faster. Below is a VB version of the game. Can you score higher
Posted by Calvin_Hsia | 4 Comments
Filed under:

Use a dictionary to help create a mnemonic

I was using a program that was yet another TLA and I wanted to create a mnemonic to help me remember what it was. One of the letters was “k”, so I wanted to find a word that starts with “k” Simple: load a dictionary, search for words starting with “k”
More Posts Next page »
 
Page view tracker