Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Inserting a blank datagridview row into a datgridview

Options
  • 28-10-2008 6: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 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 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 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