Content Supported by Sourcelens Consulting

VERSION 5.00
Begin VB.Form frmMainForm 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "Main"
   ClientHeight    =   720
   ClientLeft      =   5820
   ClientTop       =   915
   ClientWidth     =   5550
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   720
   ScaleWidth      =   5550
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton cmdFormShow 
      Caption         =   "Data Grids"
      Height          =   420
      Index           =   3
      Left            =   4110
      TabIndex        =   3
      Top             =   135
      Width           =   1320
   End
   Begin VB.CommandButton cmdFormShow 
      Caption         =   "HFlexGrid"
      Height          =   420
      Index           =   2
      Left            =   2790
      TabIndex        =   2
      Top             =   135
      Width           =   1320
   End
   Begin VB.CommandButton cmdFormShow 
      Caption         =   "Combo"
      Height          =   420
      Index           =   1
      Left            =   1470
      TabIndex        =   1
      Top             =   135
      Width           =   1320
   End
   Begin VB.CommandButton cmdFormShow 
      Caption         =   "Shape"
      Height          =   420
      Index           =   0
      Left            =   150
      TabIndex        =   0
      Top             =   135
      Width           =   1320
   End
End
Attribute VB_Name = "frmMainForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
' Constant for the default file path of the Nwind.mdb file.
' Change this path if you have installed the file elsewhere.
Const FilePath = "C:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB"

Private Sub cmdFormShow_Click(Index As Integer)
    Select Case Index
    Case 0
        frmDEShape.Show
        FormsUnload
    Case 1
        frmDESQL.Show
        FormsUnload
    Case 2
        frmHFlex.Show
        FormsUnload
    Case 3
        frmGrids.Show
        FormsUnload
    End Select
End Sub

Private Sub Form_Load()
    Dim strC As String ' ConnectionString
    ' Create the ConnectionString using the FilePath constant.
    strC = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=" & FilePath
    
    If CheckForFile(FilePath) = False Then
        MsgBox "The Northwind database (nwind.mdb) isn't found at the location: " & FilePath & vbCrLf & _
        "The file can be found on the Visual Studio CD, Disk 1: VB98\Nwind.mdb or " & vbCrLf & _
        "on the Visual Basic CD, Disk 1: VB98\Nwind.mdb." & vbCrLf & vbCrLf & _
        "Please copy the file to the default location, or change the path."
        End
    End If
    deNwind.cnNwind.ConnectionString = strC
    
    StoreShape
End Sub

Private Function CheckForFile(strPath) As Boolean
    ' Use the FileSystemObject in the Microsoft Scripting Runtime Library
    ' to check for the existence of the Nwind.mdb file.
    Dim fs As New FileSystemObject
    Dim nwindfil As File
    On Error GoTo FileErr
    Set nwindfil = fs.GetFile(strPath)
    CheckForFile = True
    Exit Function
FileErr:
    If Err.Number = 53 Then CheckForFile = False
    Exit Function
End Function

Private Sub Form_Unload(Cancel As Integer)
    If Forms.Count > 1 Then
        Unload Forms(1)
    End If
End Sub

Private Sub mnuExit_Click()
    End
End Sub