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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textbox formatting 2

Status
Not open for further replies.

glove

Technical User
Aug 24, 2000
42
US
The format for my textbox is set to Currency. The variable that is going in the textbox is also Currency. But, the textbox is not displaying the contents in Currency format. What am I doing wrong?
 
What do you mean by the "format" of your text box.. There is no "format" property of a text box? How are you setting this format??
Simon
 
You're probably using a masked edit box which has a format property (VB5)

Or perhaps VB6's textbox has a format property? Don;t know I don't own a copy...

In any case, for some wierd reason the VB5 masked edit box doesn't format until you set the multi-line property to true.
 
swilliams,

I'm refering to the dataformat property of the textbox.
 
Ahhh, "DataFormat" is used when the textbox is bound to a data control.

To set your format, you'll have to use a format command when you set the .Text property. Like:

[tab]txtMyMoney.Text = format(MyVariable, "currency")

Chip H.
 
Try the following
Add a reference to Data Formatting Objects Library

Dim WithEvents Weight_Format As StdDataFormat

Set Weight_Format = New StdDataFormat
Weight_Format.Type = fmtCustom
Weight_Format.Format = "##,##0.000"


Set txtArray(8).DataFormat = Weight_Format
txtArray(9).DataField = "Weight"

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top