473,385 Members | 1,461 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,385 software developers and data experts.

Object reference not set to an instance of an object for data table fill

I've manually created a database (based on the Manage a Music Collection ...
article on theMSDN site) with three data tables. I then populated the tables
with data.

When I preview the data, I see the data I entered on all three tables. So
the data and the data tables must be there.

I then dragged three GridViews onto the form and in the form load routine
put the lines
Me.ArtistsTableAdapter.Fill(Me.Database1DataSet.Ar tists)

Me.RecordingsTableAdapter.Fill(Me.Database1DataSet .Recordings)

Me.TracksTableAdapter.Fill(Me.Database1DataSet.Tra cks)

When I do this I get the error "Object reference not set to an instance of
an object"for the first line. If I comment out that line, the program runs
and the other two GridView tables fill properly.

I'm sure that in my playing around with the code (I'm just tryuing to learn
database programming)something must have gotten screwed up. Does anyone know
how to fix this?

I'm using VB2005 beta2.

Thanks.

Chuck Gantz


Nov 21 '05 #1
2 3553
you have to use the 'new' keyword, simple enough, dim whatever as
system.watever = new system.whatever
hope this helps

george

'---------------------------------
' option strict does exist, use it
'---------------------------------

Nov 21 '05 #2
Me.ArtistsTableAdapter = New
'ProjectName'.Database1DataSet.ArtistsTableAdapter
where 'ProjectName' is of course your project name, this should be in
your 'formName'.Designer.vb, but if its not then you need to add it
manually, if you dont know, you can check this in VB2k5, by going to
the solution explorer, clicking "Show all files", and expanding the
form, if this is present, than you have to check if the 'Artists'
table, or dataset does exist, and is plopped onto your form, thirdly
that its assigned a 'friend withevents' in the designer

again, hope this helps

george
'---------------------------------
' option strict does exist, use it
'---------------------------------

Nov 21 '05 #3

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

Similar topics

2
by: Pkpatel | last post by:
Hi, I keep getting this error every time I try to load crystalreportviewer on a webform with a dataset. Here is the error: -------------------------------------------------------- Server...
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"...
1
by: D Pahadsing | last post by:
i'm using asp.net 1.1 & ms access. the ms-access database is placed in a separate folder with permissions set as belo Administrator : full contro ASPNET : full contro user1 : full contro & set...
3
by: student | last post by:
Hello all, I have this problem in this code I am studying. I'm getting this error saying that Server Error 'in '/mcsdWebApps/Chapter5/DBruntime' Application. Object reference not set to an...
3
by: Adriano | last post by:
Hello, when I try to print something, either DataGrid or from Crystal Report viever the folowing error message appears and cancels printing: Object reference not set to an instance of an...
2
by: Brad | last post by:
Receive the following error when stepping into the FILL (see last line). Being a newbie I cannot see anything obvious. Error message: An unhandled exception of type...
8
by: ST | last post by:
Hello everyone, Can anyone help me with this error above when I debug my web app project in vstudio.net?? I can't figure it out! It was working fine for months, and now all of a sudden it's not!!...
12
by: Andrew Poulos | last post by:
With the following code I can't understand why this.num keeps incrementing each time I create a new instance of Foo. For each instance I'm expecting this.num to alert as 1 but keeps incrementing. ...
1
by: ravilolam | last post by:
Hi guys Ravikumar here This is the erro iam not able to rectify, can any body help me for this. Description: An unhandled exception occurred during the execution of the current web request....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.