Load Form from within Procedure

  • Thread starter Thread starter Nitromuse
  • Start date Start date
N

Nitromuse

Hello World
I've used the Data Form Wizard to create a
form "TimeForm" and that part works fine, when I call
TimeForm.show everything works fine if I hit the 'Load
Button'. Now I'm trying to load it via code from within
another procedure and can't seem to get it right, what am
I missing? I've tried just filling the adapter but get
the message 'Value can not be null' With the below code
I get the infamous 'Object reference not set to an
instance of an object' in the TimeForm.vb file at
the 'dataSet.EnforceConstraints = False' line. It all
works fine when I hit the Load Button.

.......
Dim TimeForm As New TimeForm
Dim OleDbDataAdapter1 As New _
System.Data.OleDb.OleDbDataAdapter
Dim objDsTimeForm As DsTimeForm
TimeForm.FillDataSet(objDsTimeForm)
TimeForm.Show()
End Sub

Thanks a lot for your help,
 
I've tried just filling the adapter but get
the message 'Value can not be null' With the below code
I get the infamous 'Object reference not set to an
instance of an object' in the TimeForm.vb file at
the 'dataSet.EnforceConstraints = False' line. It all
works fine when I hit the Load Button.

Try

Dim objDsTimeForm1 As New DsTimeForm
TimeForm.FillDataSet(objDsTimeForm1)
 
* "Nitromuse said:
I've used the Data Form Wizard to create a
form "TimeForm" and that part works fine, when I call
TimeForm.show everything works fine if I hit the 'Load
Button'. Now I'm trying to load it via code from within
another procedure and can't seem to get it right, what am
I missing? I've tried just filling the adapter but get
the message 'Value can not be null' With the below code
I get the infamous 'Object reference not set to an
instance of an object' in the TimeForm.vb file at
the 'dataSet.EnforceConstraints = False' line. It all
works fine when I hit the Load Button.

......
Dim TimeForm As New TimeForm
Dim OleDbDataAdapter1 As New _
System.Data.OleDb.OleDbDataAdapter
Dim objDsTimeForm As DsTimeForm

\\\
objDsTimeForm = New DsTimeForm()
///
 
Back
Top