Programming Tutorial On The Way

free online programming resource on dotnet, csharp, web related topics

Visual Basic specifies a Boolean’s default values as zero for False and -1 for True. You may save and set the value of a check box, based on the absolute value of a Boolean variable, as these correspond to the intrinsic constants vbUnchecked and vbChecked:
Read the rest of this entry »

Popularity: 13% [?]

Unlike the Windows 95 common controls, the standard list box doesn’t have a horizontal scrollbar when list items are too wide to fit within the list box. Fortunately, it’s not hard to direct a listbox control to display a horizontal scrollbar. Add this code to a form’s Load event. It fills a list box with 100 long strings and calls SetHScroll to show a horizontal scrollbar in the list box:

Private Sub Form_Load()
	Dim i As Integer
	For i = 1 To 100
		List1.AddItem CStr(i) & _
			" bottle(s) of beer on the wall."
	Next i
	SetHScroll Me, List1, List1.List(0)
End Sub

Read the rest of this entry »

Popularity: 14% [?]

Setting an element in an array of option buttons to True is easy. Click on the option button, or use this code:

OptionArray(ThisOne) = True

ThisOne is the Index of the member you want to be selected. Getting the True member of an option array is not so simple. Because you need to perform this kind of task in almost any reasonably complex program, adding this function to your code library or generic module simplifies the task. You don’t need to know the array size in advance:
Read the rest of this entry »

Popularity: 13% [?]

When attempting to determine which option buttons a user has selected from an array of option buttons, use this code instead of using an inefficient If-Then construct:

intSelectedItem = Option(0).Value * O - _
    Option(1).Value*1 - Option(2).Value * 2

Read the rest of this entry »

Popularity: 13% [?]