473,396 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

HELP: System.NullReferenceException Error

(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.DsCustomersOrder s1.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
Nov 20 '05 #1
7 1465
Is customer id being set before the Initailize event fires from the Sheet?

is Value null?
"VB Programmer" <Ro************************@juno.com> wrote in message
news:OT**************@TK2MSFTNGP10.phx.gbl...
(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.DsCustomersOrder s1.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

Nov 20 '05 #2
I figured it out.

In Sheet1_Initialize I did this:
Dim dv As New DataView(Me.DsCustomersOrders1.Orders)
Instead of this:
dv = New DataView(Me.DsCustomersOrders1.Orders)

LOL - I'm a dork.

Thanks!

"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
news:u4**************@TK2MSFTNGP12.phx.gbl...
Is customer id being set before the Initailize event fires from the Sheet?

is Value null?
"VB Programmer" <Ro************************@juno.com> wrote in message
news:OT**************@TK2MSFTNGP10.phx.gbl...
(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.DsCustomersOrder s1.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


Nov 20 '05 #3
I don't see how that solves your rowfilter problem...
"VB Programmer" <Ro************************@juno.com> wrote in message
news:e2**************@TK2MSFTNGP10.phx.gbl...
I figured it out.

In Sheet1_Initialize I did this:
Dim dv As New DataView(Me.DsCustomersOrders1.Orders)
Instead of this:
dv = New DataView(Me.DsCustomersOrders1.Orders)

LOL - I'm a dork.

Thanks!

"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
news:u4**************@TK2MSFTNGP12.phx.gbl...
Is customer id being set before the Initailize event fires from the Sheet?

is Value null?
"VB Programmer" <Ro************************@juno.com> wrote in message
news:OT**************@TK2MSFTNGP10.phx.gbl...
(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.DsCustomersOrder s1.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



Nov 20 '05 #4
I am sure you do,

:-))

Private dv As DataView
Sub
Dim dv As New DataView(Me.DsCustomersOrders1.Orders)
End Sub
Public Property CustomerId() As String
dv.RowFilter = "CustomerID='" & value & "'"
End Class
Nov 20 '05 #5
> I am sure you do,

:-))

Private dv As DataView
Sub
Dim dv As New DataView(Me.DsCustomersOrders1.Orders)
^^^^ isn't this creating a localized instance of the DataView? So when the
scope leaves this sub, this Dataview will be inaccessable.
End Sub
Public Property CustomerId() As String
dv.RowFilter = "CustomerID='" & value & "'"

^^^^ this is still looking at the class level dataview??? not the local
declared within that method.
End Class


Nov 20 '05 #6
Hi CJ,

You get a 10 from me, what means here Excellent

:-))

Cor
Nov 20 '05 #7
Cheers mate =)

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:ug**************@TK2MSFTNGP09.phx.gbl...
Hi CJ,

You get a 10 from me, what means here Excellent

:-))

Cor

Nov 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Fredrik | last post by:
Im getting: "An unhandled exception of type 'System.NullReferenceException' occurred in system.dll Additional information: Object reference not set to an instance of an object." The error is...
4
by: Frawls | last post by:
Hi, I get the following error when trying to run a search on my aspx site, this error only occours if the product im searching for does not exist. Can anybody explain this please and help me...
2
by: Raed Sawalha | last post by:
i have a windows form(Main) with listview, when click an item in listview i open other window form (Sub) which generate the selected item from parent window in as treeview items when click any item...
0
by: noe | last post by:
I have done a DLL in unmanaged code C++ and in that dll I have defined a function that use memcpy.This dll run ok.I use that dll in a aplication in C# managed code in Visual Studio .NET. I import...
1
by: msnews.microsoft.com | last post by:
I'm trying to fill an array of objects but when I add the first object I get a NullReferenceException. ----------------------------------------------------------------------------...
0
by: muralidharan | last post by:
WebForm1.aspx Code: <%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %> <ComponentArt:TreeView id="TreeView1" Height="520"...
8
by: Tim::.. | last post by:
Can someone please tell me why I keep getting the following error for some of my web application users but not others??? Even though the application runs from a central webserver??? Thanks for...
2
by: sxiao | last post by:
Hi, there I got a NullReferenceException when there are more than one users trying to open the same page at the same time. The senerio is: Two users logged into the web application using the...
6
by: William Mild | last post by:
I must be getting brain fried. I can't see the error. Create a new web form with the following code begind: Public Class test Inherits System.Web.UI.Page Public Class ReportCardData ...
9
by: KenLee | last post by:
I made an application which includes classic asp page and asp.net page. when I tried to redirect from classic asp page to asp.net 2.0 page, it works under my local IIS directory. ex) <a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.