Solved

GridView bind a 2d array

Posted on 2008-06-16
2
1,054 Views
Last Modified: 2013-11-26
Hi,

I have a 2 dimensional array ...

Dim arr(50, 3) as string

I have put the data into this array, but now i want to put the data from the array into a gridview.  Has anyone got the code to do this?

Thanks,

Darryl
0
Comment
Question by:yo_daz_uk
2 Comments
 
LVL 4

Accepted Solution

by:
zveljkovic earned 100 total points
ID: 21792358
Hi. here is some sample code for you.
			DataTable t = new DataTable("name");

//add coresponding number of columns or just go in for loop

			t.Columns.Add("col1");

			t.Columns.Add("col2");

			t.Columns.Add("col3");

			t.Columns.Add("col4");

//add new row 

			t.Rows.Add( new String[] {"asdf","qwer","ertt","rtyerty"});

			t.Rows.Add( new String[]  {"asdf","qwer","ertt","rtyerty"});

//databind

			this.dataGridView1.DataSource = t;

Open in new window

0
 

Author Closing Comment

by:yo_daz_uk
ID: 31467540
i used similar code to the above to achieve this
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

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