How to get only the Whole Number of a Price Value in Decimal from a DataGridView?

Lucifer Rodstark

I have an SQL Query for price that displays it on a DataGridView with decimals for example (500.00) but the original datatype of the price column is an integer so I had to concatinate in on the SQL Query. The case is when I am getting the value from the DataGridView to a TextBox it gets the whole value with the decimals to the TextBox. What I wish to happen is that it ignores the decimals and only gets the whole number of the price. (500.00 - DataGridView) (500 - TextBox)

Here is my code:

Private Sub BilliardItemGrid_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles BilliardItemGrid.CellClick // this is the DataGridView Cell Click function

    If e.RowIndex >= 0 Then
        Dim row As DataGridViewRow

        row = Me.BilliardItemGrid.Rows(e.RowIndex)

        Inventory.load_itemtypebilliard(Inventory_EditBothItem.ComboBox1)
        Inventory_EditBothItem.TextBox3.Text = row.Cells("ID").Value.ToString
        Inventory_EditBothItem.TextBox1.Text = row.Cells("Barcode ID").Value.ToString
        Inventory_EditBothItem.Label16.Text = row.Cells("Barcode ID").Value.ToString
        Inventory_EditBothItem.TextBox2.Text = row.Cells("Name").Value.ToString
        Inventory_EditBothItem.ComboBox3.Text = "Billiard"
        Inventory_EditBothItem.Label18.Text = "Billiard"
        Inventory_EditBothItem.ComboBox1.Text = row.Cells("Type").Value.ToString
        Inventory_EditBothItem.Label17.Text = row.Cells("Type").Value.ToString
        Inventory_EditBothItem.TextBox4.Text = row.Cells("Price").Value.ToString // this is how I get the value of the price from the DataGridView to a TextBox
        Inventory_EditBothItem.Label15.Text = row.Cells("Price").Value.ToString // this is how I get the value of the price from the DataGridView to a Label
        Inventory_EditBothItem.TextBox5.Text = row.Cells("Quantity").Value.ToString
        Inventory_EditBothItem.TextBox6.Text = row.Cells("Critical").Value.ToString
        Inventory_EditBothItem.DateTimePicker1.Text = row.Cells("Date Modified").Value.ToString
        Inventory_EditBothItem.ComboBox2.Text = row.Cells("Status").Value.ToString
        Inventory_EditBothItem.TextBox8.Text = row.Cells("Description").Value.ToString

        Inventory.load_givenid()


    End If

    If Inventory_EditBothItem.TextBox1.Text = Nothing Then
        MetroMessageBox.Show(Me, "Select a Billiard Item First", "System Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
    Else

        Inventory_EditBothItem.ShowDialog()

        If Inventory_EditBothItem.Visible = False Then
            Inventory.load_billiarditemtable(BilliardItemGrid)
            Inventory.load_bowlingitemtable(BowlingItemGrid)
            Inventory.load_allitemtable(AllItemGrid)
            Store.load_itemstoretable(ItemStoreGrid)
            Reports.load_itemlisttable(ItemTransactionGrid, ItemTransactionComboBoxInDemand)
            Reports.load_audittable(AuditGrid, AuditComboBoxUser, AuditComboBoxType, AuditDateTimePicker1, AuditDateTimePicker2, AuditRadioButtonAll, AuditRadioButtonSpecDate)
        End If

    End If

End Sub
Mary

Try converting to an Integer.

Inventory_EditBothItem.TextBox4.Text = CInt(row.Cells("Price").Value).ToString
Inventory_EditBothItem.Label15.Text = CInt(row.Cells("Price").Value).ToString 

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to get value from input element as a number in decimal

From Dev

How to round up decimal value to the nearest whole number?

From Dev

How to get whole part of decimal number in AngularJS bindings

From Dev

Get number with decimal value

From Dev

How to round of a decimal number to lowest whole number?

From Dev

Convert decimal to whole number - but ignoring value

From Dev

how do you get a negative decimal value from 8 bit signed binary number?

From Dev

How to get decimal value from Slider?

From Dev

How to get the closest number from a List<Price> with LINQ?

From Dev

How to get the closest number from a List<Price> with LINQ?

From Dev

Get all whole and decimal numbers from string

From Dev

Oracle SQL, separating a Number string to get whole number and decimal separately

From Dev

Only return a decimal if it's not a whole number. JAVA

From Dev

How to get minimum and maximum value from a `rangpicker` for price slider?

From Dev

Display Double as string ignoring decimal part when the value is a whole number

From Dev

How to convert price format to number only with php?

From Dev

Select Price value only from td in python

From Dev

How can I get only the decimal from a float in lua?

From Dev

How can I get whole string value from List in apex

From Dev

How to get number of decimal places

From Dev

How to get cell value from DataGridView in VB.Net?

From Dev

How to get a value from a datagridview to a variable VB.net

From Dev

How to get column ("id") value from datagridview with visual basic .net

From Dev

get only number from value and calculate the length from text field

From Dev

How to switch decimal and rounded whole number using javascript

From Dev

How to switch decimal and rounded whole number using javascript

From Dev

How do I convert a fractional decimal to a whole number in Swift

From Dev

How to get decimal value from divide in fish shell

From Dev

How to get decimal value from divide in fish shell

Related Related

  1. 1

    How to get value from input element as a number in decimal

  2. 2

    How to round up decimal value to the nearest whole number?

  3. 3

    How to get whole part of decimal number in AngularJS bindings

  4. 4

    Get number with decimal value

  5. 5

    How to round of a decimal number to lowest whole number?

  6. 6

    Convert decimal to whole number - but ignoring value

  7. 7

    how do you get a negative decimal value from 8 bit signed binary number?

  8. 8

    How to get decimal value from Slider?

  9. 9

    How to get the closest number from a List<Price> with LINQ?

  10. 10

    How to get the closest number from a List<Price> with LINQ?

  11. 11

    Get all whole and decimal numbers from string

  12. 12

    Oracle SQL, separating a Number string to get whole number and decimal separately

  13. 13

    Only return a decimal if it's not a whole number. JAVA

  14. 14

    How to get minimum and maximum value from a `rangpicker` for price slider?

  15. 15

    Display Double as string ignoring decimal part when the value is a whole number

  16. 16

    How to convert price format to number only with php?

  17. 17

    Select Price value only from td in python

  18. 18

    How can I get only the decimal from a float in lua?

  19. 19

    How can I get whole string value from List in apex

  20. 20

    How to get number of decimal places

  21. 21

    How to get cell value from DataGridView in VB.Net?

  22. 22

    How to get a value from a datagridview to a variable VB.net

  23. 23

    How to get column ("id") value from datagridview with visual basic .net

  24. 24

    get only number from value and calculate the length from text field

  25. 25

    How to switch decimal and rounded whole number using javascript

  26. 26

    How to switch decimal and rounded whole number using javascript

  27. 27

    How do I convert a fractional decimal to a whole number in Swift

  28. 28

    How to get decimal value from divide in fish shell

  29. 29

    How to get decimal value from divide in fish shell

HotTag

Archive