GridView bind a 2d array

Posted on 2008-06-16
Last Modified: 2013-11-26

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?


Question by:yo_daz_uk

Accepted Solution

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





//add new row 

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

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


			this.dataGridView1.DataSource = t;

Open in new window


Author Closing Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

896 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

11 Experts available now in Live!

Get 1:1 Help Now