VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   2925
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4860
   LinkTopic       =   "Form1"
   ScaleHeight     =   2925
   ScaleWidth      =   4860
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdCreate 
      Caption         =   "Create"
      Height          =   495
      Left            =   3360
      TabIndex        =   2
      Top             =   2280
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   1560
      TabIndex        =   1
      Text            =   "Text1"
      Top             =   1440
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "1"
      Height          =   495
      Index           =   0
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Visible         =   0   'False
      Width           =   1215
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdCreate_Click()

    Dim intIndex As Integer
    Dim intTop As Integer
    
    If Not IsNumeric(Text1.Text) Or _
            Val(Text1.Text) < 1 Or _
            Val(Text1.Text) > 24 Then
        MsgBox "Please enter a number between 1 and 24"
        Exit Sub
    End If
    
    Command1(0).Visible = True
    intRowCount = 1
    
    For intIndex = 1 To Text1.Text - 1
        Load Command1(intIndex)
        If intIndex Mod 4 = 0 Then
            Command1(intIndex).Left = 0
            intTop = intTop + Command1(0).Height
'            Command1(intIndex).Top = Command1(intIndex - 3).Top + Command1(0).Height
        Else
            Command1(intIndex).Left = Command1(intIndex * intRowCount - 1).Left + Command1(0).Width
        End If
        Command1(intIndex).Top = intTop
        Command1(intIndex).Visible = True
        Command1(intIndex).Caption = intIndex + 1
    Next
    Text1.Visible = False
    cmdCreate.Visible = False
    
End Sub





