adding rows dynamically to an unbound DatagridView control in VB.net

This is my problem. I am adding ROWS dynamically to a datagridview using this statement:

Dim vRow() As String = {Trim(datefiled), Trim(ctyID), Trim(Type), Trim(Name), Trim(status)}
 grdConsole.Rows.Add(vRow)

where grdconsole is an unbound datagrid. And I am adding a ROw to the grid after a record is processed. What is happening is that the ROW is getting added to the END. What should I do to add the row to the begining so the latest ones appear on top?

Please let me know.
VBSolutionSeekerAsked:
Who is Participating?
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.

JimBrandleyCommented:
You can use this:
grdConsole.Rows.Insert(rowIndex, values)

rowIndex is the position where you want the row inserted.

Jim
0

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
VBSolutionSeekerAuthor Commented:
I have no idea as to how many rows would be there in the grid. it is infinite. Could you please give me sample code as to how i would go about adding the rows so that the later ones appear on top? Even with the index, it is going to add it to the bottom, right?

0
JimBrandleyCommented:
I think in VB, the first index = 1. If you keep inserting at 1, each new one will be at the top of the list.

Jim
0
VBSolutionSeekerAuthor Commented:
Hi,
could you please give me some sample code. i tried doing this in vain. thanks in advance

0
VBSolutionSeekerAuthor Commented:
i finally got around doing this. thanks all.
0
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
.NET Programming

From novice to tech pro — start learning today.