V
VB Programmer
(Using Whidbey, but I don't think it matters.)
I keep getting this error:
System.NullReferenceException: Object reference not set to an instance
of an object.
Here is the line it's happening to:
dv.RowFilter = "CustomerID='" & value & "'"
(It is happening in the property "Set" code below.)
The dv variable IS declared at a larger scope. What is happening? See code
below....
Public Class Sheet1
Private dv As DataView
Private Sub Sheet1_Initialize(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Me.Initialize
Try
Dim uc1 As New UserControl1
Me.CustomersTableAdapter1.Fill(Me.DsCustomersOrders1.Customers)
Me.OrdersTableAdapter1.Fill(Me.DsCustomersOrders1.Orders)
Dim dv As New DataView(Me.DsCustomersOrders1.Orders)
dv.AllowEdit = False
'Dim uc1 As New ExcelApplication1.UserControl1
Globals.ThisWorkbook.ActionsPane.Controls.Add(uc1)
List1.SetDataBinding(dv, "", "CustomerID", "OrderDate",
"ShippedDate")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Public Property CustomerId() As String
Get
End Get
Set(ByVal value As String)
Try
' ERROR IS HAPPENING HERE
dv.RowFilter = "CustomerID='" & value & "'"
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Set
End Property
End Class
I keep getting this error:
System.NullReferenceException: Object reference not set to an instance
of an object.
Here is the line it's happening to:
dv.RowFilter = "CustomerID='" & value & "'"
(It is happening in the property "Set" code below.)
The dv variable IS declared at a larger scope. What is happening? See code
below....
Public Class Sheet1
Private dv As DataView
Private Sub Sheet1_Initialize(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Me.Initialize
Try
Dim uc1 As New UserControl1
Me.CustomersTableAdapter1.Fill(Me.DsCustomersOrders1.Customers)
Me.OrdersTableAdapter1.Fill(Me.DsCustomersOrders1.Orders)
Dim dv As New DataView(Me.DsCustomersOrders1.Orders)
dv.AllowEdit = False
'Dim uc1 As New ExcelApplication1.UserControl1
Globals.ThisWorkbook.ActionsPane.Controls.Add(uc1)
List1.SetDataBinding(dv, "", "CustomerID", "OrderDate",
"ShippedDate")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Public Property CustomerId() As String
Get
End Get
Set(ByVal value As String)
Try
' ERROR IS HAPPENING HERE
dv.RowFilter = "CustomerID='" & value & "'"
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Set
End Property
End Class