Hi,

I want to ask how to add/insert new row/record and it show at the top in datagridview.

i don't want the new add record at the bottom but i want it at the top.

I mean,the current is at the top in datagridview.

i'm adding the new record is not from inside the datagridview,but from textbox at outside datagridview.

Thank you.

Hi,

You can try something like this:

Me.DataGridView1.Rows.Insert(0, value1, value2) ' values you entered

Didn't tested it

thanks.but, it's not functioning

Hi,

Did you had some errors?
How did you used that part of code?
...

try something like this

datagridview1.rows.add()

dim row AS integer = datagridview1.rows.count -1 
    while row > 0
       'if you have more cells in the row simple copy and paste the line below and change the cell
        ' number
       datagridview1.rows(row).cell(0).value = datagridview1.rows(row-1).cell(0).value
       datagridview1.rows(row).cell(1).value = datagridview1.rows(row-1).cell(1).value
       row = row -1
     End While

datagridview1.rows(0).cells(0).value = 'whatever you want to add to the first row

hope this helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.