Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Inserting a blank datagridview row into a datgridview

  • 28-10-2008 06:26PM
    #1
    Closed Accounts Posts: 2,268 ✭✭✭


    I have a datagridview on a form I want to conditionally insert a seperator between rows.
            For iRow = 1 To dgvUserlist.rowcount
    
                If dgvUSERLIST.Item("USER", iRow).Value <> dgvUserlist.Item("USER", iRow - 1).Value Then
                    dgvUserlist.Rows.Add(iRow)
    
    [b]  DO STUFF HERE[ /B]
    
                End If
    
            Next
    
    
    So I want to compare the value of the users column with the one above it and insert a seperator.

    Anyone have any thoughts?


Comments

  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    It seems to me that what you want to do is display one or more rows for each user and each user (indepenedent of the number of rows they have) will have a seperator between them.

    It seems to me in the code above that you're iterating through the gridview's row after they've been databound. You'd probably want to do this during databinding.


  • Closed Accounts Posts: 2,268 ✭✭✭mountainyman


    The issue there is that the datagridview is not bound. That is there is no underlying datatable. At least there is no underlying datatable being formally created by me.

    MM


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    Could you use a repeater control to render the HTML for you? That, to me, would be a lot easier than going the gridview route.


  • Registered Users, Registered Users 2 Posts: 610 ✭✭✭nialo


    Evil Phil wrote: »
    Could you use a repeater control to render the HTML for you? That, to me, would be a lot easier than going the gridview route.


    Second this.

    Also how are you displaying data if you are not binding?


  • Closed Accounts Posts: 2,268 ✭✭✭mountainyman


    I am passing a stroed procedure name and variable to sql dat reader.

    This problem is resolved I increased the height of the relevant row. There was a color field in the grid but I juts replaced the color with an image.


  • Advertisement
Advertisement