Link to home
Start Free TrialLog in
Avatar of Tygh
Tygh

asked on

VB.net datagrid ButtonColumn for VB.net windows app

I am working with a datagrid and I am trying to add a button column.  I can not seem to find the buttoncolumn for a datagrid.  I am not sure if this is because I have only VB.net studio or if it because you can only use a button column for web apps.  

Here is my current code.

        Dim ts As DataGridTableStyle
        ts = New DataGridTableStyle
        ts.MappingName = DS1.Tables(0).ToString()
      Dim col1 As New DataGridTextBoxColumn
        With col1
            .MappingName = "StockNum"
            .HeaderText = "Stock #"
            .Width = 80
        End With

        Dim col2 As New DataGridTextBoxColumn
        With col2
            .MappingName = "Desc"
            .HeaderText = "Description"
            .Width = 80
        End With

        Dim col3 As New DataGridTextBoxColumn
        With col3
            .MappingName = "AskingPrice"
            .HeaderText = "Asking Price"
            .Width = 80
            .Format = "c"
            .Alignment = HorizontalAlignment.Right
        End With

        ts.GridColumnStyles.AddRange(New DataGridColumnStyle() {col1, col2, col3, col4, col5, col6, col7})
        With grdInventory
            .TableStyles.Add(ts)
            .DataSource = DS1.Tables(0)
        End With

I want to add a column with  buttons for my first column that will bring up a details page.  
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial