J
john
I'm having some Interop problems. I really need someone's
help on this, i'm running out of ideas. I have upgraded
my Data access controls to the latest ver.
Now then i have a form with these ref's:
Interop.DAO,System,System.Data,System.Drawing,System.windo
ws.forms,System.XML.
all that's on this form is a button and when the button
is clicked it opens up a fox pro database and gets the
needed info/close. Now this works just fine on my
development PC. no errors/no probs. But when i move it
over to my win NT 4x machine it throws this err.
object ref not set to a instance of a object.
'Mod
Module UpgradeSupport
Friend DAODBEngine_definst As New DAO.DBEngine()
End Module
'click Evt for form1
Private Sub Command1_Click(ByVal eventSender As
System.Object, ByVal eventArgs As System.EventArgs)
Handles Command1.Click
MsgBox(GetLoanCode("RNM31025.DBF", 0))
End Sub
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Try
' Loads the companies list information and
stores it in the
' collection complist
Dim db As DAO.Database
Dim tbl As DAO.Recordset
Dim tmpServer As String
Dim tmpRemoteSite As Boolean
Dim DAODBEngine_definst As New DAO.DBEngine()
'Set db = OpenDatabase
("\\serverc\c\datasys\", False, False, "FoxPro 2.5;")
db = DAODBEngine_definst.OpenDatabase
("C:\Complist\", False, False, "FoxPro 2.5;")
tbl = db.OpenRecordset("COMPLIST",
DAO.RecordsetTypeEnum.dbOpenSnapshot)
tbl.MoveLast()
tbl.MoveFirst()
Dim clsComplist As New CompanyList()
While Not tbl.EOF
If Trim(tbl.Fields("ID").Value & "")
<> "" Then
tmpServer = tbl.Fields
("Server").Value & ""
tmpRemoteSite = CBool(tbl.Fields
("RemoteSite").Value & "")
If tmpServer = "" Then tmpServer = "A"
clsComplist.GetCompanies.Add
(tbl.Fields("ID").Value, tbl.Fields("Billcode").Value
& "", tmpServer, CShort(tbl.Fields("RemoteType").Value
& ""), tmpRemoteSite)
tmpServer = ""
End If
tbl.MoveNext()
End While
MsgBox("done")
Catch
MsgBox(Err.Number & " " & Err.Description)
End Try
End Sub
'form1 info
Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Friend Class Form1
Inherits System.Windows.Forms.Form
#Region "Windows Form Designer generated code "
Public Sub New()
MyBase.New()
If m_vb6FormDefInstance Is Nothing Then
If m_InitializingDefInstance
Then
m_vb6FormDefInstance
= Me
Else
Try
'For the
start-up form, the first instance created is the default
instance.
If
System.Reflection.Assembly.GetExecutingAssembly.EntryPoint
..DeclaringType Is Me.GetType Then
m_vb6FormDefInstance = Me
End If
Catch
End Try
End If
End If
'This call is required by the Windows
Form Designer.
InitializeComponent()
End Sub
'Form overrides dispose to clean up the
component list.
Protected Overloads Overrides Sub Dispose(ByVal
Disposing As Boolean)
If Disposing Then
If Not components Is Nothing
Then
components.Dispose()
End If
End If
MyBase.Dispose(Disposing)
End Sub
'Required by the Windows Form Designer
Private components As
System.ComponentModel.IContainer
Public ToolTip1 As System.Windows.Forms.ToolTip
Public WithEvents Command1 As
System.Windows.Forms.Button
'NOTE: The following procedure is required by
the Windows Form Designer
'It can be modified using the Windows Form
Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.components = New
System.ComponentModel.Container()
Me.ToolTip1 = New System.Windows.Forms.ToolTip
(Me.components)
Me.Command1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Command1
'
Me.Command1.BackColor =
System.Drawing.SystemColors.Control
Me.Command1.Cursor =
System.Windows.Forms.Cursors.Default
Me.Command1.Font = New System.Drawing.Font
("Arial", 8.0!, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Command1.ForeColor =
System.Drawing.SystemColors.ControlText
Me.Command1.Location = New System.Drawing.Point
(56, 96)
Me.Command1.Name = "Command1"
Me.Command1.RightToLeft =
System.Windows.Forms.RightToLeft.No
Me.Command1.Size = New System.Drawing.Size(185,
41)
Me.Command1.TabIndex = 0
Me.Command1.Text = "Command1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5,
13)
Me.ClientSize = New System.Drawing.Size(312, 209)
Me.Controls.AddRange(New
System.Windows.Forms.Control() {Me.Command1})
Me.Font = New System.Drawing.Font("Arial", 8.0!,
System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
#Region "Upgrade Support "
Private Shared m_vb6FormDefInstance As Form1
Private Shared m_InitializingDefInstance As
Boolean
Public Shared Property DefInstance() As Form1
Get
If m_vb6FormDefInstance Is
Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
m_InitializingDefInstance = True
m_vb6FormDefInstance
= New Form1()
m_InitializingDefInstance = False
End If
DefInstance =
m_vb6FormDefInstance
End Get
Set
m_vb6FormDefInstance = Value
End Set
End Property
#End Region
cheers.
help on this, i'm running out of ideas. I have upgraded
my Data access controls to the latest ver.
Now then i have a form with these ref's:
Interop.DAO,System,System.Data,System.Drawing,System.windo
ws.forms,System.XML.
all that's on this form is a button and when the button
is clicked it opens up a fox pro database and gets the
needed info/close. Now this works just fine on my
development PC. no errors/no probs. But when i move it
over to my win NT 4x machine it throws this err.
object ref not set to a instance of a object.
'Mod
Module UpgradeSupport
Friend DAODBEngine_definst As New DAO.DBEngine()
End Module
'click Evt for form1
Private Sub Command1_Click(ByVal eventSender As
System.Object, ByVal eventArgs As System.EventArgs)
Handles Command1.Click
MsgBox(GetLoanCode("RNM31025.DBF", 0))
End Sub
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Try
' Loads the companies list information and
stores it in the
' collection complist
Dim db As DAO.Database
Dim tbl As DAO.Recordset
Dim tmpServer As String
Dim tmpRemoteSite As Boolean
Dim DAODBEngine_definst As New DAO.DBEngine()
'Set db = OpenDatabase
("\\serverc\c\datasys\", False, False, "FoxPro 2.5;")
db = DAODBEngine_definst.OpenDatabase
("C:\Complist\", False, False, "FoxPro 2.5;")
tbl = db.OpenRecordset("COMPLIST",
DAO.RecordsetTypeEnum.dbOpenSnapshot)
tbl.MoveLast()
tbl.MoveFirst()
Dim clsComplist As New CompanyList()
While Not tbl.EOF
If Trim(tbl.Fields("ID").Value & "")
<> "" Then
tmpServer = tbl.Fields
("Server").Value & ""
tmpRemoteSite = CBool(tbl.Fields
("RemoteSite").Value & "")
If tmpServer = "" Then tmpServer = "A"
clsComplist.GetCompanies.Add
(tbl.Fields("ID").Value, tbl.Fields("Billcode").Value
& "", tmpServer, CShort(tbl.Fields("RemoteType").Value
& ""), tmpRemoteSite)
tmpServer = ""
End If
tbl.MoveNext()
End While
MsgBox("done")
Catch
MsgBox(Err.Number & " " & Err.Description)
End Try
End Sub
'form1 info
Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Friend Class Form1
Inherits System.Windows.Forms.Form
#Region "Windows Form Designer generated code "
Public Sub New()
MyBase.New()
If m_vb6FormDefInstance Is Nothing Then
If m_InitializingDefInstance
Then
m_vb6FormDefInstance
= Me
Else
Try
'For the
start-up form, the first instance created is the default
instance.
If
System.Reflection.Assembly.GetExecutingAssembly.EntryPoint
..DeclaringType Is Me.GetType Then
m_vb6FormDefInstance = Me
End If
Catch
End Try
End If
End If
'This call is required by the Windows
Form Designer.
InitializeComponent()
End Sub
'Form overrides dispose to clean up the
component list.
Protected Overloads Overrides Sub Dispose(ByVal
Disposing As Boolean)
If Disposing Then
If Not components Is Nothing
Then
components.Dispose()
End If
End If
MyBase.Dispose(Disposing)
End Sub
'Required by the Windows Form Designer
Private components As
System.ComponentModel.IContainer
Public ToolTip1 As System.Windows.Forms.ToolTip
Public WithEvents Command1 As
System.Windows.Forms.Button
'NOTE: The following procedure is required by
the Windows Form Designer
'It can be modified using the Windows Form
Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.components = New
System.ComponentModel.Container()
Me.ToolTip1 = New System.Windows.Forms.ToolTip
(Me.components)
Me.Command1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Command1
'
Me.Command1.BackColor =
System.Drawing.SystemColors.Control
Me.Command1.Cursor =
System.Windows.Forms.Cursors.Default
Me.Command1.Font = New System.Drawing.Font
("Arial", 8.0!, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Command1.ForeColor =
System.Drawing.SystemColors.ControlText
Me.Command1.Location = New System.Drawing.Point
(56, 96)
Me.Command1.Name = "Command1"
Me.Command1.RightToLeft =
System.Windows.Forms.RightToLeft.No
Me.Command1.Size = New System.Drawing.Size(185,
41)
Me.Command1.TabIndex = 0
Me.Command1.Text = "Command1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5,
13)
Me.ClientSize = New System.Drawing.Size(312, 209)
Me.Controls.AddRange(New
System.Windows.Forms.Control() {Me.Command1})
Me.Font = New System.Drawing.Font("Arial", 8.0!,
System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
#Region "Upgrade Support "
Private Shared m_vb6FormDefInstance As Form1
Private Shared m_InitializingDefInstance As
Boolean
Public Shared Property DefInstance() As Form1
Get
If m_vb6FormDefInstance Is
Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
m_InitializingDefInstance = True
m_vb6FormDefInstance
= New Form1()
m_InitializingDefInstance = False
End If
DefInstance =
m_vb6FormDefInstance
End Get
Set
m_vb6FormDefInstance = Value
End Set
End Property
#End Region
cheers.