Results 1 to 11 of 11

Thread: [RESLOVED][vbe 2008] DataGridView button color

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2007
    Posts
    81

    [RESLOVED][vbe 2008] DataGridView button color

    Hi,

    I am trying to add rows containing a button to a Datagridrow control and would like the button to be red. When I use the code below the button does not turn red but the cell containing the button does. How can I turn the button red? Thanks.

    Private Sub AddRow(ByVal Product As String, ByVal Stock As String)

    Dim NewRow As DataGridViewRow = New DataGridViewRow
    Dim CellButton As DataGridViewCell

    CellButton = New DataGridViewButtonCell
    CellButton.Value = Stock
    CellButton.Style.BackColor = Color.Red
    NewRow.Cells.Add(CellButton)

    DataGridView1.Rows.Add(NewRow)

    DataGridView1.AutoResizeColumns()

    End Sub
    Last edited by DC123; Jan 4th, 2009 at 05:49 AM.

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