October 1, 1996

Using Rnd Function

Question: Is there any way I can have a % chance in random events. (say you click on a button and you have a 30% chance of it doing one thing, a 20% chance of doing another, and a 50% chance of it doing another) I have no idea on

Varying Length Dynamically

Question: I know VB insists on a _constant_ for the array subscript. Has anyone found a way around this? I would like to set an array length equal to the number of records in an Access 2.0 table. Answer: The best way to do this is to first Dim the

Putting Buttons on PictureBox

Question: My question is that I’m trying to put a command buttons in a picture box on MDI form (it’s a text editor). But it always keeps on givin’ me this error “Controls without the aligned property cannot be be placed directly on MDI form”. Could you please help me

Putting a ProgressBar on a StatusBar

Question: Both the ProgressBar and the StatusBar appear to be welcome additions to the VB controls set. But, while I have had to create each of the various built-in StatusBar styles at least once in the past, I have never created a roll-your-own status bar without a roll-your-own progress bar

Changing Database Structure

Question: I’m using VB 3.0 to work with databases in the Jet 2.0 format. I expect it will be necessary to add new fields to the database sometime in the future. Will I have to create a new database file and then transfer all the old records to the new

Editing Forms Directly

Question: I want to present screens of text in an application. I plan to use label controls and would like to cut and paste the text from my word processor rather than retype it into the caption field of the label properties.However paste doesn’t seem to work? Answer: What you

Controlling Netscape

Question: I’m trying to write an application that loads URLs into the user’s web browser, but it’s based on the shell function and fires up a second Netscape window when the user submits the URL. How do I get VB to just load the URL into an existing Netscape window?

Calling a Form’s Subroutines

Question: How can I call another Form’s subroutine? Answer: Under VB3 you can’t call another form’s subroutine. If you need to do this, put the sub into a .BAS module. However, under VB4, you can make a public subroutine that can be called from outside of the form.

Setting Windows Wallpaper

Question: I am trying to use the API call SystemParametersInfo to change the Windows wallpaper. It works great in a Borland C program I wrote, but doesn’t work in VB. All that happens is that the wallpaper turns blue. Answer: The API call you should have declared in VB should