Question on Numeric Formatting...

M

Manuel Canas

Hi there,

I'm building an application with ADO.NET and VB.NET.
This is the issue that I have right now;
I'm using this code with a data reader to populate a form from a database
(sqlServer, MSDE)

*****************
Dim us as New CultureInfo("en-US")
txtTestPrice.Text() = drSQL.Item("Price").ToString()
******************

I'm trying to convert this string into a curreny format type and I'm not
having any luck on this one.
I'm importing the System.Globalization namespace.
it gives an error when I do this

txtTestPrice.Text() = drSQL.Item("Price").ToString("c", us)
Error - Public Overridable Function ToString() As String' has no parameters
and it's return type cannot be indexed.

Can anybody out there help out on this one? Please!
Thanks very much for your help on this matter.
Manny.
 
C

Cor Ligthert

Hi Manuel,

Maybe you have seen it already it seems that there was a contest in the
language.vb newsgroup yesterday evening (my time) about this question.

http://tinyurl.com/2bysd

I found the one from Ken the nicest, however a simple answer is that you
have first to convert the string to a decimal before you can use the mask.

I hope this helps?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top