DataGridView control - move to row with desired value in first column

Posted on 2012-08-14
Last Modified: 2012-08-15
Hi Experts,

I have a DataGridView control with a BindingSource.

When my Form is loaded I want the DataGridView to move to the row given by "RequiredID" which is a unique Index displayed in the first column.

Question by:LeighWardle
    LVL 83

    Accepted Solution

    You will need to loop through the rows and set the selected row

    For i as integer = 0 to grid.rows.count - 1
       if grid.item(0, i).value = "myvalue" then
          grid.currentcell = grid.item(0, i)
          exit for
       end if  
    LVL 1

    Author Closing Comment

    Thanks again CodeCruiser.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    This video discusses moving either the default database or any database to a new volume.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now