VB.net show 2 decimal places in a DataGridView


I use the following code to populate a DataGridView on a Windows form.
I need to show the results to two decimal places even if the number
is 125.00.
How do I do this?
Sub FillDGV_Supplier()

            Dim sSQL As String

            If Me.ComboBox_SupplierStatus.SelectedIndex = 0 Then
                sSQL = "Select * From [Q3 Supplier Totals]"
            ElseIf Me.ComboBox_SupplierStatus.SelectedIndex = 1 Then
                sSQL = "Select * From [Q3 Supplier Totals Unpaid]"
            ElseIf Me.ComboBox_SupplierStatus.SelectedIndex = 2 Then
                sSQL = "Select * From [Q3 Supplier Totals Paid]"
            End If

            Dim connection As New OleDbConnection(ConnectionString)
            Dim dataadapter As New OleDbDataAdapter(sSQL, connection)
            Dim ds As New DataSet()
            dataadapter.Fill(ds, "Suppliers_table")
            DataGridView_Supplier.DataSource = ds
            DataGridView_Supplier.DataMember = "Suppliers_table"


            'Me.DataGridView_Supplier.Columns(1).Width = 25

        Catch ex As Exception
        End Try

    End Sub

Open in new window

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
Kiran SonawaneProject LeadCommented:
You can do like this

Me.DataGridView_Supplier.Columns("UnitPrice").DefaultCellStyle.Format = "c"
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
thanks very much
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.