Click here to Skip to main content
15,902,445 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
hello every one.....

i hve one datagrid view in

when i click on cell i get value in textboxes....then i click on delete button...

nd i rebind my datagridview....but i wnt to go in lastposition which one i selected....

like my code is...

public sub bidngridview()

dim adap as oracledataAdapter
adap=new OracleDataAdapter("select * from subcategory",dl.con)
ds=new dataset()

End Sub

Private Sub btnDelete_click()
cmd=new oracleCommand("delete from subcategory where autoid='"+grdAutodi.ToString()+"'",dl.con)
call bindgridview()
DataGridView1.Rows(crtrow).Selected = True

end sub

crtrow is my last Index of selected rows....

Thanks & Regards

Daljeet Singh
Software Developer

Just remove the line

from your Delete click procedure, this will solve the issue.

Share this answer
If you rebind, you will lose your selection. If you must do this, get the selection first, then mark it selected again after binding.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900