Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2007

Tip: Looking for answers? Try searching our database.

ToString method - formatting codes?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Darrell Wesley - 01 Oct 2007 17:38 GMT
1) Where can I find the valid set of formatting codes that can be used with
the tostring method?

2) When using the following statement I get an invalid cast error --- why?
 X0SS = drResult("X0SS").tostring("f2")
    where drResult is a datarow and the value of drResult("X0SS") is 2.75 a
double.
If I change it to the following then no error occurs:
X0SS = cDbl(drResult("X0SS")).tostring("f2")
Armin Zingler - 01 Oct 2007 18:19 GMT
> 1) Where can I find the valid set of formatting codes that can be
> used with the tostring method?

In the .Net Framework docs. (Working with base types -> Formatting types ->
Numeric Format Strings)

> 2) When using the following statement I get an invalid cast error
> --- why?  X0SS = drResult("X0SS").tostring("f2")
>     where drResult is a datarow and the value of drResult("X0SS") is
> 2.75 a double.

Maybe because X0SS is not declared as a string.

> If I change it to the following then no error occurs:
> X0SS = cDbl(drResult("X0SS")).tostring("f2")

What is the type of X0SS?

Armin
Darrell Wesley - 01 Oct 2007 20:29 GMT
X0SS was originally defined as type object I have changed it to type String
but the error remained. The error message said something about not being able
to convert type string to integer??

> > 1) Where can I find the valid set of formatting codes that can be
> > used with the tostring method?
[quoted text clipped - 15 lines]
>
> Armin
Armin Zingler - 01 Oct 2007 22:38 GMT
> X0SS was originally defined as type object I have changed it to type
> String but the error remained. The error message said something
[quoted text clipped - 17 lines]
> >
> > What is the type of X0SS?

Did you enable Option Strict? If not, do it and solve all compile errors.

Armin

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.