Code Snippet

5 views
Skip to first unread message

VB2005

unread,
Jun 12, 2007, 8:48:49 AM6/12/07
to Visual Basic 2005
Welcome to this code Snippet, feel free to post here any code snippet
you want !

VB2005

unread,
Jun 12, 2007, 9:13:59 AM6/12/07
to Visual Basic 2005
Add all Known Colors to ComboBox/ListBox Control
Imports System.Drawing
Dim kColor As KnownColor
For kColor = KnownColor.AliceBlue To KnownColor.YellowGreen
cmbColor.Items.Add(kColor)
Next

VB2005

unread,
Jun 12, 2007, 1:32:47 PM6/12/07
to Visual Basic 2005
Add Special folder to a list box
replace lst by your list box name

Code :
Dim sFolder As Environment.SpecialFolder
For sFolder = 0 To 43
If Not Char.IsNumber(sFolder.ToString) Then
lst.Items.Add(sFolder.ToString)
End If
Next

On 12 juin, 14:48, VB2005 <omar.abid2...@gmail.com> wrote:

VB2005

unread,
Jun 12, 2007, 1:34:44 PM6/12/07
to Visual Basic 2005
This snippet will show you how to create random number

'Instantiate the random class
Dim r As Random = New Random
'
'Get a random number within the full range of a integer value.
MsgBox(r.Next())
'
'Generates a random number from 0 up to the set maximum. It is
'set not to return a number larger than 20.
MsgBox(r.Next(20))
'
'Generates a random number within the minumum and maximum
'numbers that are specified. IT will not return a number lower
'than the setMinumum, or return a number higher than the
setMax.
MsgBox(r.Next(10, 15))


On 12 juin, 14:48, VB2005 <omar.abid2...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages