Twister Posted September 23, 2005 Posted September 23, 2005 Hello, I'm working with VB.net 2005 and I'm using Datagridview. What I would like to do is to add a complete column (not only the header!). I know its possible to do the following: Dim row0 As String() = {"6/30/1992", "3", "Dress", "P J Harvey", "Dry"} With Me.dataGridView1.Rows .Add(row0) End With (Found this in Documentation) But can I do this with Colums too? Sorry if this is a stupid question... Thanks in Advance, Twister Quote
Goksly Posted September 23, 2005 Posted September 23, 2005 Not that I know of - ie as you have done there. What you could do is have the data you want to add in the column in an array and then loop through... ie string[] strExample = new string[] { "one", "two", "three" }; foreach( string strSingle in strExample ) { drNewRow = dtDataTable.NewRow(); drNewRow[ intOfColumnYouAreAddingDataToo ] = strSingle; dtDataTable.Rows.Add( drNewRow ); } Im pretty new to all this C# stuff, but if I wanted to populate a single column in a datatable thats what I'd do :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.