Add a new row on a datagrid

Hi I’m trying to create and add a new row on my datagrid. The type of this row is different from all the other rows on my datagrid. It’s like a new header. I already have a header. If there is a way to have multiple headers that would work too. when I try to add a new row inside the datagrid_ItemDataBound() method the first record on my datagrid was not shown.. any help ?
thanks
yellowflameAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Craig WardmanSoftware Developer & Solution ArchitectCommented:
Although you can add many tables into one dataset, as far as I know its not possible to have multiple tables as the datasource for one datagrid..

You will need multiple datagrid.. Consider loading them at runtime maybe?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
yellowflameAuthor Commented:
I don’t need to have multiple tables…
Craig WardmanSoftware Developer & Solution ArchitectCommented:
The headers of a datagrid represent the column names of the schema of the table which the datagrid represents, in order to have rows which follow a different schema would require a different table, but you cant show both tables in the same grid..

If that is what you were after..

i.e.

Dim table1 as DataTable
Dim table2 as DataTable
Dim allData as DataSet

with table1
 .columns.add("FirstName")
 .columns.add("Surname")
end with

with table2
 .columns.add("Car")
 .columns.add("Colour")
end with

allData.Tables.add(table1)
allData.Tables.add(table2)

DataGridView1.DataSource=allData.DefaultViewManager.CreateDataView(allData.Tables(0))
DataGridView2.DataSource=allData.DefaultViewManager.CreateDataView(allData.Tables(1))

(code untested, so may not compile)

If however, you want to have another row of column headers that fit the same schema as the original data and also all the rows following the header fit the same schema, then you could just insert the header row as a normal row and then change the DefaultCellStyle on that row to make it look different from a normal cell..
yellowflameAuthor Commented:
i haven't try any of the above code because i don't want to have two datagrids.

thanks a lot for your comments
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.