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

C

Chuck Gantz

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.Artists)

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

Me.TracksTableAdapter.Fill(Me.Database1DataSet.Tracks)



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
 
G

George

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
'---------------------------------
 
G

George

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
'---------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top