Solved

Adding data to datatable

Posted on 2008-09-30
2
1,081 Views
Last Modified: 2013-11-26
I am using visual basic .net 2005.
I added a new dataset to my project: DataSet1.xsd
In the DataSet1.xsd, I created a datatable: DataTable1
In the DataTable1 I created columns: DataColumn1, DataColumn2

Im going to be using the the dataset in  crystal report. I have to crystal report created already
using the dataset created above.

Now, I am trying to add rows to the datatable of which is obviously in the dataset
but when I try, I keep getting decleration errors and such.

Anyone  give an example of some code to add rows to a datatable of which
the datasets/datatables are created in the designer.

I have seen code to add rows to datasets/datatables created in code, but i dont want to do it that way.
0
Comment
Question by:crw
2 Comments
 
LVL 27

Accepted Solution

by:
VBRocks earned 500 total points
ID: 22606006
Dim table as New DataSet1()
table.Rows.Add("Item 1", "Item 2")

'Add 5 rows:
For i as Integer = 1 to 5
    table.Rows.Add("Item " & i, "Item " & (i + 5))
Next
0
 

Author Comment

by:crw
ID: 22608074
Ok, that worked great. Now to use the dataset information between different forms, I would have to create the DIM line above in a module and instead declare the variable  as PUBLIC?
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now