V
Vayse
My Load event is running 3 times.
I'm calling the form two different ways, and it always runs 3 times. As you
can imagine, this makes the load time slow!
Any help appreciated.
Vayse
Method 1:
Dim fAsset As New frmAsset
fAsset.AssetView = fAsset.ViewAsset
fAsset.AssetCode = stAssetCode
fAsset.Show()
Method 2:
Dim fAsset As New frmAsset
fAsset.AssetView = fAsset.ViewAll
fAsset.Show()
'********************************************************************
Private Sub frmAsset_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load, MyBase.Load, MyBase.Load
Me.ScheduleTableAdapter.Fill(Me.AssetsDataSet.Schedule)
Me.MethodsTableAdapter.Fill(Me.AssetsDataSet.Methods)
Me.SubCatgsTableAdapter.Fill(Me.AssetsDataSet.SubCatgs)
Me.StatusTableAdapter.Fill(Me.AssetsDataSet.Status)
Me.SuppliersTableAdapter.Fill(Me.AssetsDataSet.Suppliers)
Me.DeptsTableAdapter.Fill(Me.AssetsDataSet.Depts)
Me.CostCentresTableAdapter.Fill(Me.AssetsDataSet.CostCentres)
iOpened += 1
Try
Select Case iAssetView
Case conVIEW_ASSET
Debug.Print(iAssetView & ": One & " & iOpened)
Me.AssetsTableAdapter.FillByAsset(Me.AssetsDataSet.Assets,
stAssetCode)
Case conVIEW_SUB
Debug.Print(iAssetView & ": Sub & " & iOpened)
Me.AssetsTableAdapter.FillBySub(Me.AssetsDataSet.Assets,
lSubCatgID)
Case Else
Debug.Print(iAssetView & ": All & " & iOpened)
Me.AssetsTableAdapter.Fill(Me.AssetsDataSet.Assets)
End Select
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
bLoaded = True
End Sub
I'm calling the form two different ways, and it always runs 3 times. As you
can imagine, this makes the load time slow!
Any help appreciated.
Vayse
Method 1:
Dim fAsset As New frmAsset
fAsset.AssetView = fAsset.ViewAsset
fAsset.AssetCode = stAssetCode
fAsset.Show()
Method 2:
Dim fAsset As New frmAsset
fAsset.AssetView = fAsset.ViewAll
fAsset.Show()
'********************************************************************
Private Sub frmAsset_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load, MyBase.Load, MyBase.Load
Me.ScheduleTableAdapter.Fill(Me.AssetsDataSet.Schedule)
Me.MethodsTableAdapter.Fill(Me.AssetsDataSet.Methods)
Me.SubCatgsTableAdapter.Fill(Me.AssetsDataSet.SubCatgs)
Me.StatusTableAdapter.Fill(Me.AssetsDataSet.Status)
Me.SuppliersTableAdapter.Fill(Me.AssetsDataSet.Suppliers)
Me.DeptsTableAdapter.Fill(Me.AssetsDataSet.Depts)
Me.CostCentresTableAdapter.Fill(Me.AssetsDataSet.CostCentres)
iOpened += 1
Try
Select Case iAssetView
Case conVIEW_ASSET
Debug.Print(iAssetView & ": One & " & iOpened)
Me.AssetsTableAdapter.FillByAsset(Me.AssetsDataSet.Assets,
stAssetCode)
Case conVIEW_SUB
Debug.Print(iAssetView & ": Sub & " & iOpened)
Me.AssetsTableAdapter.FillBySub(Me.AssetsDataSet.Assets,
lSubCatgID)
Case Else
Debug.Print(iAssetView & ": All & " & iOpened)
Me.AssetsTableAdapter.Fill(Me.AssetsDataSet.Assets)
End Select
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
bLoaded = True
End Sub