Solved

Adding data to datatable

Posted on 2008-09-30
2
1,089 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

867 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

21 Experts available now in Live!

Get 1:1 Help Now