Author Archives: mrsnowlover

VB6 Only Allow Upper Case or Lower Case in Textbox

The BEST way to enforce only upper case or lower case characters in a textbox is simply:

Another possible solution is:


read more

VB6 Close Any Window with SendMessage

This function/sub closes any window you can get the handle/hwnd to.

In a module:

VB6 Copy Listbox to Another Listbox – copy or move all list items of one list box to another list box

The most common known way to move all the items of one listbox to another is through the use of a loop like so:

That method is fine and there is nothing wrong

read more

VB6 Listbox No Duplicates, Super Fast, Words for any .Multiselect Option of Listbox

There are two basic bits of code on the internet for ensuring your listbox does not add a duplicate item to it.

  1. One of the ways is to loop through ever single list item and compare each of the list items to the item you want to add. If you get through the entire list without a match you know you have no duplicate so the item gets added to the listbox.
    DOWNSIDE: slow, especially if your list has thousands of items.
  2. The second way is setting the .text of the listbox to whatever the text is you want to add. For example if you want to add  “a big fury cat”, set list1.text = “a big fury cat” and then check the listindex property. If it is -1 then the item is not in the list and you can add it.
    DOWNSIDE: does not work if the .multiselect is either 1- Simple or 2 – Extended. Only works if the listbox .multiselect property is 0 – none.

The ideal way to add non duplicate list items to list box and the fastest way

Top of your module:

The function that adds non

read more