Imports System.IO
Imports System.Reflection

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        ' generated automatically
        productsTableAdapter.Fill(nORTHWNDDataSet.Products)
        categoriesTableAdapter.Fill(nORTHWNDDataSet.Categories)

    End Sub

    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()
        AppDomain.CurrentDomain.SetData("DataDirectory", Environment.GetFolderPath(Environment.SpecialFolder.Personal) & "\ComponentOne Samples\Common")
        Dim dbFile As String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal) & "\ComponentOne Samples\Common", "Northwnd.mdf")
        If Not File.Exists(dbFile) Then
            Throw New Exception("Sample database Northwnd.mdf must be created in the Common folder. Run the CreateSampleDB utility to create the Northwind database")
        End If

    End Sub
End Class
