473,503 Members | 1,687 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Convert class

why there isn't a Convert.ToFloat() method in the Convert class?
Sometimes I can't work with a float field because there isn't this method
and I need it to, for example, convert the input in a textBox to a float
field.

Thank you
Nov 16 '05 #1
2 22147
Alberto,

You will have to use the ToSingle method on the Convert class. This is
the name for a float in the BCL. Float is an alias provided by C#.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Alberto" <al*****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
why there isn't a Convert.ToFloat() method in the Convert class?
Sometimes I can't work with a float field because there isn't this method
and I need it to, for example, convert the input in a textBox to a float
field.

Thank you

Nov 16 '05 #2
Alberto <al*****@nospam.com> wrote:
why there isn't a Convert.ToFloat() method in the Convert class?
Sometimes I can't work with a float field because there isn't this method
and I need it to, for example, convert the input in a textBox to a float
field.


Because Float isn't the name of the type in question - Single is.
There's a Convert.ToSingle() method, just like there's
Convert.ToInt32() instead of Convert.ToInt().

The shorthand of "float" for System.Single is a C# notion, rather than
a .NET one.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2139
by: vipin | last post by:
My C# console application takes 5 parameters two of which are supposed to be inherently integers So I do COnvert.ToInt32(args) There is no problem with the console application when I run it...
14
7292
by: Mick | last post by:
I wrote a C# program that interfaces with a data vendor over the web using an API they supplied and their examples in C#. Now I have another data vendor's API and example that I want to add to...
3
10241
by: Convert TextBox.Text to Int32 Problem | last post by:
Need a little help here. I saw some related posts, so here goes... I have some textboxes which are designed for the user to enter a integer value. In "old school C" we just used the atoi function...
2
1176
by: Makarand | last post by:
Hi Can anybody tell me how to use TypeConvertor class? Thing is i want to do dynamic(during runtime) type casting in my code. Thnanx Makarand
2
2119
by: swartzbill2000 | last post by:
I want to PostMessage from a class instance to its containing form. I want the WPARAM to point to the class instance. I am using the declaration of PostMessage from www.pinvoke.net. WPARAM is an...
4
9155
by: Hyun-jik Bae | last post by:
Is that not allowed to assume generic type numeric type? As far as I've tried, I got an error with the following code: public class AAA<T> { public int Foo(T a) { return a; // error: Cannot...
1
5457
by: quantass | last post by:
Im using C#, ASP.NET v1.1. My class contains intrinsic types, ArrayList, and XmlDocument types. Some variables have the value NULL. After usng XmlSerializer and the information on:...
3
1980
by: rengaraj | last post by:
Dear Friends, Any software available for converting .class file to .java file. ?? If any please suggest. Advance Thanks, Rengaraj.R
1
7049
by: ramanujam kv | last post by:
I have two C# classes (Interop & Assembly)which is shown below public class CTest { public CTest() { } public void SimpleFunction()
0
7332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
382
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.