CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    May 2006
    Posts
    17

    Resolved DataGrid View TextMatrix???

    Hi,
    Can Anyone Tell me how to Access a particular column of a particular row. Same as there is TextMatrix Property in FlexGrid.
    For e.g In FlexGrid I use
    Val(grd.TextMatrix(R, 8)) to access the value at Rth row and 8th Column.
    Can AnyOne tell me how to achieve the same funtionlity using
    datagrid view.I am using using VB 2005 Express Edition.
    thanks

  2. #2
    Join Date
    Oct 2005
    Location
    Islamabad, Pakistan
    Posts
    1,277

    Re: DataGrid View TextMatrix???

    item property of datagridview
    Code:
    text=DataGridView1.Item(1,2).Value.ToString

  3. #3
    Join Date
    Oct 2005
    Location
    Islamabad, Pakistan
    Posts
    1,277

    Re: DataGrid View TextMatrix???

    u can also do this
    Code:
    Text = DataGridView1.Rows(1).Cells(2).Value.ToString

  4. #4
    Join Date
    May 2006
    Posts
    17

    Re: DataGrid View TextMatrix???

    I have tried bot of your suggestion but I am receiving error as below:
    I any thing something that I am doing wrong.PLZ Help....


    Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index

  5. #5
    Join Date
    Oct 2005
    Location
    Islamabad, Pakistan
    Posts
    1,277

    Re: DataGrid View TextMatrix???

    the row at index 1 and column at index 2 do not exist in ur datagridview thats why u get this indexOutofRange exception.

  6. #6
    Join Date
    May 2006
    Posts
    17

    Re: DataGrid View TextMatrix???

    Quote Originally Posted by aniskhan
    u can also do this
    Code:
    Text = DataGridView1.Rows(1).Cells(2).Value.ToString
    Still, I am getting the error.
    PLZ Help me
    Object reference not set to an instance of an object.

  7. #7
    Join Date
    Oct 2005
    Location
    Islamabad, Pakistan
    Posts
    1,277

    Re: DataGrid View TextMatrix???

    Sample

    using Access DB "Attendence"
    Student (Table)
    --------
    rno number
    name text
    sessno number

    Can u show how r u using it in ur code so anybody can help u.
    Attached Files Attached Files

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

Featured