VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3330
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5355
   LinkTopic       =   "Form1"
   ScaleHeight     =   3330
   ScaleWidth      =   5355
   StartUpPosition =   3  'Windows Default
   Begin VB.ListBox List3 
      Height          =   2205
      ItemData        =   "Form1.frx":0000
      Left            =   2640
      List            =   "Form1.frx":0002
      TabIndex        =   9
      Top             =   840
      Width           =   855
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   4200
      TabIndex        =   7
      Text            =   "Text2"
      Top             =   2400
      Width           =   495
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Get my (kind of) random number!"
      Height          =   855
      Left            =   3840
      TabIndex        =   6
      Top             =   840
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1920
      TabIndex        =   4
      Text            =   "Text1"
      Top             =   1200
      Width           =   495
   End
   Begin VB.ListBox List2 
      Height          =   2205
      ItemData        =   "Form1.frx":0004
      Left            =   1080
      List            =   "Form1.frx":0006
      TabIndex        =   2
      Top             =   840
      Width           =   495
   End
   Begin VB.ListBox List1 
      Height          =   2205
      ItemData        =   "Form1.frx":0008
      Left            =   360
      List            =   "Form1.frx":000A
      TabIndex        =   0
      Top             =   840
      Width           =   495
   End
   Begin VB.Label Label5 
      Alignment       =   2  'Center
      Caption         =   "New number list"
      Height          =   375
      Left            =   2520
      TabIndex        =   10
      Top             =   360
      Width           =   975
   End
   Begin VB.Label Label4 
      Caption         =   """Random"" number"
      Height          =   255
      Left            =   3720
      TabIndex        =   8
      Top             =   2040
      Width           =   1455
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      Caption         =   "Edit Odds"
      Height          =   255
      Left            =   1800
      TabIndex        =   5
      Top             =   840
      Width           =   735
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      Caption         =   "Odds"
      Height          =   255
      Left            =   960
      TabIndex        =   3
      Top             =   480
      Width           =   735
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Caption         =   "Number"
      Height          =   255
      Left            =   240
      TabIndex        =   1
      Top             =   480
      Width           =   735
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim i As Integer
Dim x As Integer
Dim z As Integer
Dim intNumberEntries As Integer
Dim intSum As Integer

Private Sub Form_Load()
    List1.Clear
    List2.Clear
    For i = 1 To 10
        List1.AddItem i
        List2.AddItem 10
    Next i
    Text1.Text = ""
    Text2.Text = ""
    Debug.Print List1.ListCount & " " & List2.ListCount
End Sub

Private Sub List1_Click()
    List2.Selected(List1.ListIndex) = True
    Text1.Text = List2.List(List1.ListIndex)
    Text1.SetFocus
    Text1.SelStart = 0
    Text1.SelLength = Len(Text1.Text)
End Sub

Private Sub List2_Click()
    List1.Selected(List2.ListIndex) = True
End Sub

Private Sub Text1_Change()
    If Text1.Text = "" Then Exit Sub
    List2.List(List1.ListIndex) = Text1.Text
End Sub

Private Sub Command1_Click()
    'Here is where it gets interesting!
    List3.Clear
    intSum = 0
    For i = 0 To List2.ListCount - 1
        intSum = intSum + List2.List(i)
    Next i
    For i = 0 To List1.ListCount - 1
        intNumberEntries = ((List2.List(i)) / 100) * intSum
        For x = 1 To intNumberEntries
            List3.AddItem List1.List(i)
        Next x
    Next i
    Randomize
    'now lets get that number!
    z = (Rnd(1) * List3.ListCount) + 1
    Text2.Text = List3.List(z)
End Sub
