|
-
Mar 19th, 2004, 10:29 AM
#1
Thread Starter
Member
Object reference not set to an instance of an object..sometimes?
I have a application in VB.NET 2003 using Crystal Reports to create reports from an Access database. The problem I am running with one of my customers is that on two of the computers, when running crystalreportviewer for several reports, it returns the message in my subject line. There is one computer that is able to run all reports without a problem. They are all Windows 98 PCs. The reports also view correctly on my Windows 98 PC I use for testing. I do have the convertnullfieldtodefault set to true. Any ideas?
Thanks
-
Mar 19th, 2004, 11:41 PM
#2
Sounds like a coding issue, you must have forgot a New somewhere.
-
Mar 20th, 2004, 09:42 AM
#3
PowerPoster
Hi,
First thing to do is see what differences there are between the computors which display the error and those which don't. Usually it will be because they are accessing different databases and you coding differs slightly when handling each database. Just a thought, have you got separate coding for Access and SQL databases? If so, check your instantiating in both.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Mar 22nd, 2004, 10:01 AM
#4
Thread Starter
Member
All computers are accessing the same Access database, so there is no need to have different coding for SQL. As I have been checking this out, I noticed that all of the Win98 computers that work had .net framework 1.0 installed with the previous version of my app (VB.NET 2002). The current version is using .net framework 1.1 & VB.NET 2003. I thought maybe there was something in the 1.0 framework that would make the one computer work. To check this out, I formatted my Win98 computer and installed only the 1.1 version. It worked fine, so I know it's not something missing in my installation CD or something in 1.0 framework. The code is real basic:
VB Code:
Private Sub frmRpt_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Me.LoadDataSet()
Catch eLoad As System.Exception
System.Windows.Forms.MessageBox.Show(eLoad.Message)
End Try
Dim rpt As New rptReport
rpt.SetDataSource(objdsRpt)
CrystalReportViewer1.ReportSource = rpt
End Sub
Are there any known programs that might conflict with Crystal report veiwer?
Thanks for you help,
Joe
-
Mar 22nd, 2004, 05:58 PM
#5
PowerPoster
Hi,
Have you found out which object is at the root of the problem?
Try putting a breakpoint at the line where the error occurs. Check this out on both computors (one which works and one which does not). Then check the status of the relevant objects at that point.
If the error occurs in the code section you posted, which line?
I recall that once (not in VB) I had a similar unsolvable problem, which I got round by inserting some extra unnecessary code just before the error arose. This apparently had the efect of altering a sequence which "upset" the host computor - I never found out why. (All I did was to execute a print- one- character- to -the -console instruction)
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Mar 22nd, 2004, 07:30 PM
#6
Hyperactive Member
I am having a related problem. I've created several small programs in vb.net that are all being run on computers in my office with windows 98 and the .net framework installed. Every program that doesn't have a crystal report embedded in it works fine. Every program that has a crystal report gives a process id and thread error before it even starts. I am assuming it's the crystal report that's causing this error since it's the only common denominator between all the programs that won't load.
Any ideas?
-
Mar 23rd, 2004, 09:51 AM
#7
Thread Starter
Member
I have put a breakpoint at the line which sets the datasource for the viewer. I am able to step through the code until it set the reportsource for the viewer and then the viewer starts up and I lose control. The error occurs once the reportsource is set. I have tried to put an handleexception sub for the viewer to get more info about the error, but it doesn't seem to do anything. Any other ideas?
Thanks for your help,
Joe
-
Mar 23rd, 2004, 10:21 AM
#8
Frenzied Member
when you say you are merely allocating an address in memory for future use. you have nothing in there yet.
you have to instantiate it next:
that way the program takes that class and creates an empty object for you. It equals NOTHING now. if you want to refer to an existing object to manipulate it, you leave off the NEW keyword.
that's just my.02 you may have already known that.
-
Mar 23rd, 2004, 03:21 PM
#9
PowerPoster
HI,
It sounds like your problem could lie in the database. It may be slightly different in the computor which gives the error message. Is that computor using the same version of Access as the others? Has the user modified the database without your knowledge? To check this you could try altering a few database items on a machine where your programme works and try to replicate the error message. By the way, check to see you are not using any reserved words as field names etc. (e.g. NAME)
The other thought is Crystal Reports. If you search through this forum for threads on Crystal reports, you will find several problems have arisen. I did this yesterday and was surprised to notice the large number of threads on the subject which had no responses!
Last edited by taxes; Mar 23rd, 2004 at 03:25 PM.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Mar 23rd, 2004, 05:00 PM
#10
Thread Starter
Member
Thanks for the reply,
The computer that is not working is using a UDL file to point to the shared database on the computer that is working. The error occurs both when accessing the shared database and when the UDL file points to it's own database.
I have also noticed the number of problems people are having with Crystal. I posted this problem in another forums and it seems like people try to avoid even reading it.
It seems to have something to do with some Win98 computers. All Win2000 and XP work fine as well as several Win98.
I'll keep diggin. Thanks for your help,
Joe
-
Mar 23rd, 2004, 05:21 PM
#11
PowerPoster
Hi,
It's beyond my knowledge, but surely there is some way of getting the precise abject name which is causing the error? I know you cannot do this in normal .NET coding, but I would have thought that information was residing somewhere in the computor memory. Hopefully one of the experts will comment.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|