Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27156

Databound Data Grid View Format Mulitple columns to $ currency

$
0
0
I have about DataGridView that is Bound to mDataTable
Code:

    Public Class Grocery_List
    Dim mDataTable As New DataTable
Private Sub BindGrid()
        mDataTable.Columns.Add("Item")
        mDataTable.Columns.Add("Brand")
        'mDataTable.Columns.Add("PriceMatch")
        mDataTable.Columns.Add("Store")
        mDataTable.Columns.Add("Price")
        mDataTable.Columns.Add("QTY")
        mDataTable.Columns.Add("Coupon")
        ShoppingListView.DataSource = mDataTable

    End Sub

I want to format the "Price" Column as a positive currency and the "Coupon" Column as negative Currency and I cant figure out how to do it.

I have this in the designer.vb but it has always been there, but has never worked.
Code:

        'clmPrice
        '
        Me.clmPrice.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells
        Me.clmPrice.DataPropertyName = "Price"
        DataGridViewCellStyle2.Format = "C2"
        DataGridViewCellStyle2.NullValue = Nothing
        Me.clmPrice.DefaultCellStyle = DataGridViewCellStyle2
        Me.clmPrice.FillWeight = 20.77344!
        Me.clmPrice.HeaderText = "Price"
        Me.clmPrice.Name = "clmPrice"
        Me.clmPrice.Width = 56

[/CODE]

Viewing all articles
Browse latest Browse all 27156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>