Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MaskedTextBox question

Status
Not open for further replies.

djj55

Programmer
Feb 6, 2006
1,761
US
Hello,
I have a SQL server column of type money. On my VB 2005 form I would like to show the value as $410.01. If I use a textbox I get 410.0100. I have tried to use the custom mask (no currency in my default list) by using both "$#,###.00" and "$9,999.00" what I get is "$4100.1_". If I put use "$#,###.00;;\" then it shows the ";;\" at the end of the value.

How can I get the avlue I want? We may have numbers as large as several million.

Thank you,
djj
 
Try typing 'Currency' (without the quotes) for the format and see what happens.



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Thank you jebenson for the reply.
Currency for the Mask property gave me 4urrency. This gave me the idea to try $CCCCCCC which gave me the almost what I wanted: $410.01_ Thus if the value is 54432.17 the displayed would be $54432.1
notice the missing decimal place.

Oh well.
djj
 
for me both of these are same on visual.

Code:
        Dim value As Decimal = "410.0100"
        Me.MaskedTextBox1.Text = Format(value, "currency")
        Me.TextBox1.Text = Format(value, "currency")

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
How would I apply that to
Code:
        Me.ADJ_BALTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", _
            Me.PROBE_ACCOUNT_MGMTBindingSource, "ADJ_BAL", True))
        Me.ADJ_BALTextBox.Location = New System.Drawing.Point(479, 163)
        Me.ADJ_BALTextBox.Name = "ADJ_BALTextBox"
        Me.ADJ_BALTextBox.Size = New System.Drawing.Size(100, 18)
        Me.ADJ_BALTextBox.TabIndex = 28

If I use Me.ADJ_BALTextbox.Text = Format([red]???[/red], "currency") I do not have a value at this time. Please note I am not overly familar with how to use an adapter.

Thanks
djj
 
Try either
Code:
Me.ADJ_BALTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", _
            Me.PROBE_ACCOUNT_MGMTBindingSource, Format("ADJ_BAL", "Currency"), True))
or
Code:
Me.ADJ_BALTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", _
            Me.PROBE_ACCOUNT_MGMTBindingSource, "ADJ_BAL", True, "Currency"))

I am not at a place to test this code.

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Thank you,
I am learning. I tried this
Code:
'First - however it did not give the dollar sign or decimal place control
Me.ADJ_BALTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", _
    Me.PROBE_ACCOUNT_MGMTBindingSource, Format("ADJ_BAL", "currency"), True))

'Second - This worked.  Notice I had to add a couple criteria
Me.ADJ_BALTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", _
    Me.PROBE_ACCOUNT_MGMTBindingSource, "ADJ_BAL", True, _
      DataSourceUpdateMode.OnPropertyChanged, 0, "$###,##0.00"))

Thank you again,
djj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top