Solved

Adding data to datatable

Posted on 2008-09-30
2
1,096 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

729 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