|
-
Jul 18th, 2003, 08:41 AM
#1
Thread Starter
Hyperactive Member
How do I get this TextBox13 code to display in Currency Format
Code:
'TextBox13
'
Me.TextBox13.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.TextBox13.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.objMachinesAndReadings, _ "Readings.Sel_1_Paid"))
Me.TextBox13.Location = New System.Drawing.Point(79, 56)
Me.TextBox13.Name = "TextBox13"
Me.TextBox13.ReadOnly = True
Me.TextBox13.Size = New System.Drawing.Size(56, 20)
Me.TextBox13.TabIndex = 1
Me.TextBox13.TabStop = False
Me.TextBox13.Text = ""
Me.TextBox13.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
-
Jul 18th, 2003, 08:59 AM
#2
VB Code:
Dim curr As Single = 12.74
TextBox1.Text = curr.ToString("C")
This will display the currency value in the correct format for the locale that your PC is set up for.
Go into Regional Options in the control panel and select a different locale before running the code and see the difference.
This world is not my home. I'm just passing through.
-
Jul 18th, 2003, 09:01 AM
#3
Having said that, my system seems not to have caught up with the fact that Europe is now using Euros...
Anybody know if there's an update out for that yet?
This world is not my home. I'm just passing through.
-
Jul 18th, 2003, 09:11 AM
#4
Thread Starter
Hyperactive Member
trisuglow:
Do you meant this?
Code:
'TextBox13
'
Dim curr As Single = 12.74
Me.TextBox13.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.TextBox13.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.objMachinesAndReadings, "Readings.Sel_1_Paid"))
Me.TextBox13.Location = New System.Drawing.Point(79, 56)
Me.TextBox13.Name = "TextBox13"
Me.TextBox13.ReadOnly = True
Me.TextBox13.Size = New System.Drawing.Size(56, 20)
Me.TextBox13.TabIndex = 1
Me.TextBox13.TabStop = False
Me.TextBox13.Text = ""
Me.TextBox13.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
Me.TextBox13.Text = curr.ToString("c")
-
Jul 18th, 2003, 09:15 AM
#5
No.
I mean, when you put text into the box do it like I said.
I don't think you can configure the properties of the textbox to automatically format the text unless you put it into a user control or subclass it.
I'm going home for the weekend now, but if you want more info I'll probably have a chance to look at VBForums on Tuesday.
Tris.
This world is not my home. I'm just passing through.
-
Jul 18th, 2003, 09:38 AM
#6
Thread Starter
Hyperactive Member
trisuglow
Thank you very much
this worked just fine;
Code:
TextBox74.Text = CDec(TextBox74.Text).ToString("c")
Andy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|