Results 1 to 3 of 3

Thread: [2005] Extracting SELECTED Cell Text from Datagridview

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2007
    Posts
    44

    Lightbulb [2005] Extracting SELECTED Cell Text from Datagridview

    Hey everyone, so I have a big datagridview with several columns representing movies.

    Right now columns are : Title, Genre, Rating, Plot, Path

    Path is the path on the computer to the AVI file (ie C:/Movies/Matrix.avi)

    So I also have a windows media player control on my form

    What I want, is when a user selects a row (or any cell in that row), and then presses a button, the button changes the Windows Media Player "URL" property to the Path field of the selected row (every entry has a path field).

    So even if only the title cell of a movie is selected, or a genre cell - it should extract the Path of whatever row that is in and set the WMP URL to that path.

    Any ideas?

    Thank you!

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: [2005] Extracting SELECTED Cell Text from Datagridview

    Suppose that "Path" is the name of column that show the file path, you can read the value of that particular cell in the current row like this
    Code:
    Dim filePath As String = DataGridView1.CurrentRow.Cells("Path").Value.ToString()

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2007
    Posts
    44

    Re: [2005] Extracting SELECTED Cell Text from Datagridview

    Works perfectly! Thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width