texasgulfcoast
Member
- Joined
- Oct 10, 2005
- Messages
- 7
- Programming Experience
- Beginner
I want to display 10.50 instead of 10.5 to txtSalesPrice.Text when I read Access DB. It is stored in the DB as a String 10.5. How do I change the code below for txtSalesPrice.Text and txtCost.Text? Thanks in advance for any help.
VB.NET:
[FONT=Verdana][COLOR=green][FONT=Courier New][FONT=Times New Roman]' Display the current record.[/FONT][/FONT][/COLOR][/FONT][FONT=Verdana]
[FONT=Times New Roman][COLOR=blue][FONT=Courier New]Private[/FONT][/COLOR][FONT=Courier New] [COLOR=blue]Overloads[/COLOR] [COLOR=blue]Sub[/COLOR] ShowCurrentRecord([COLOR=blue]ByVal[/COLOR] drCurrent [COLOR=blue]As[/COLOR] DataRow)[/FONT][/FONT]
[FONT=Courier New][FONT=Times New Roman] txtPartNumber.Text = drCurrent.Item("fldPartNumber").ToString[/FONT][/FONT]
[FONT=Courier New][FONT=Times New Roman] txtPartDescription.Text = drCurrent.Item("fldPartDescription").ToString[/FONT][/FONT]
[FONT=Courier New][FONT=Times New Roman] txtQtyOnHand.Text = drCurrent.Item("fldQtyOnHand").ToString[/FONT][/FONT]
[FONT=Courier New][FONT=Times New Roman][COLOR=red][B] txtCost.Text = drCurrent.Item("fldCost").ToString[/B][/COLOR][/FONT][/FONT]
[FONT=Courier New][FONT=Times New Roman][COLOR=red][B] txtSalesPrice.Text = drCurrent.Item("fldSalesPrice").ToString[/B][/COLOR][/FONT][/FONT]
[FONT=Courier New][FONT=Times New Roman] [COLOR=blue]Dim[/COLOR] temp [COLOR=blue]As[/COLOR] [COLOR=blue]Integer[/COLOR] = mintCurrent + 1[/FONT][/FONT]
[FONT=Courier New][FONT=Times New Roman] lblCount.Text = temp.ToString [COLOR=green]' Current Record Number + 1 [/COLOR][/FONT][/FONT]
[FONT=Courier New][FONT=Times New Roman] lblTotalRecords.Text = dtNames.Rows.Count.ToString[/FONT][/FONT]
[FONT=Times New Roman][COLOR=blue][FONT=Courier New]End[/FONT][/COLOR][FONT=Courier New] [COLOR=blue]Sub[/COLOR][/FONT][/FONT]
[COLOR=blue][FONT=Courier New][FONT=Times New Roman]‘ Here I load the data from the DB to the DS. I tried using Currency even though it’s stored as a String in the DB. [/FONT][/FONT][/COLOR]
[FONT=Times New Roman][COLOR=blue][FONT=Courier New]Dim[/FONT][/COLOR][FONT=Courier New] odbInsertParamCost [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] _[/FONT][/FONT]
[FONT=Courier New][FONT=Times New Roman] OleDbParameter("fldCost", _[/FONT][/FONT]
[FONT=Courier New][FONT=Times New Roman] OleDbType.Currency, 20, "fldCost")[/FONT][/FONT]
[FONT=Courier New][FONT=Times New Roman] [COLOR=green]'OleDbType.VarWChar, 20, "fldCost")[/COLOR][/FONT][/FONT]
[FONT=Courier New][FONT=Times New Roman] [COLOR=green]'OleDbType.VarWChar, 0, "fldCost")[/COLOR][/FONT][/FONT]
[FONT=Times New Roman][COLOR=blue][FONT=Courier New]Dim[/FONT][/COLOR][FONT=Courier New] odbInsertParamSalesPrice [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] _[/FONT][/FONT]
[FONT=Courier New][FONT=Times New Roman] OleDbParameter("fldSalesPrice", OleDbType.VarWChar, _[/FONT][/FONT]
[FONT=Courier New][FONT=Times New Roman] 20, "fldSalesPrice")[/FONT][/FONT]
[/FONT]