Click here to Skip to main content
15,906,645 members
Home / Discussions / C#
   

C#

 
GeneralEnvironment Error Pin
Sabry19056-Apr-05 5:25
Sabry19056-Apr-05 5:25 
Generalinsert data to oracle table Pin
IvyLee6-Apr-05 5:19
IvyLee6-Apr-05 5:19 
GeneralFormat a STRING into a FLOAT Pin
Seraphin6-Apr-05 4:56
Seraphin6-Apr-05 4:56 
GeneralRe: Format a STRING into a FLOAT Pin
Tom Larsen6-Apr-05 5:14
Tom Larsen6-Apr-05 5:14 
GeneralRe: Format a STRING into a FLOAT Pin
Seraphin6-Apr-05 5:22
Seraphin6-Apr-05 5:22 
GeneralRe: Format a STRING into a FLOAT Pin
Tom Larsen6-Apr-05 5:28
Tom Larsen6-Apr-05 5:28 
GeneralRe: Format a STRING into a FLOAT Pin
Seraphin6-Apr-05 5:41
Seraphin6-Apr-05 5:41 
GeneralRe: Format a STRING into a FLOAT Pin
Tom Larsen6-Apr-05 6:03
Tom Larsen6-Apr-05 6:03 
I've written a lot of code converting string values that are clearly "float like" and never had a problem. I guess the problem is deeper. I would investigate exactly what is the string you are feeding into it because I simply can't reproduce your problem. The only other thing I can think you are running into is some bad percision mojo but your example isn't sufficient to show it.

example code:
using System;

namespace tlarsen
{
	public class test
	{
		public static int Main()
		{
			string s = "          145.35             ";  // badly fudge string to simulate abuse of formating
			float f = Convert.ToSingle(s);
			Console.WriteLine("s = " + s);
			Console.WriteLine("f = " + f.ToString());
			Console.WriteLine("1 + f = (should be 146.35) : " + (f + 1));
			return 0;
		}
	}
}

GeneralRe: Format a STRING into a FLOAT Pin
Seraphin6-Apr-05 6:17
Seraphin6-Apr-05 6:17 
GeneralRe: Format a STRING into a FLOAT Pin
Ashok Dhamija6-Apr-05 18:52
Ashok Dhamija6-Apr-05 18:52 
GeneralMaking string HTML compliant Pin
tommazzo6-Apr-05 4:24
tommazzo6-Apr-05 4:24 
GeneralRe: Making string HTML compliant Pin
techieboi7-Apr-05 6:03
techieboi7-Apr-05 6:03 
GeneralRe: Making string HTML compliant Pin
tommazzo7-Apr-05 10:43
tommazzo7-Apr-05 10:43 
QuestionC# Cursor with a rectangle? Pin
elapid6-Apr-05 4:18
elapid6-Apr-05 4:18 
AnswerRe: C# Cursor with a rectangle? Pin
elapid6-Apr-05 6:04
elapid6-Apr-05 6:04 
GeneralRe: C# Cursor with a rectangle? Pin
Tom Larsen6-Apr-05 6:16
Tom Larsen6-Apr-05 6:16 
GeneralRe: C# Cursor with a rectangle? Pin
elapid6-Apr-05 7:13
elapid6-Apr-05 7:13 
GeneralRe: C# Cursor with a rectangle? Pin
Dave Kreskowiak6-Apr-05 8:18
mveDave Kreskowiak6-Apr-05 8:18 
GeneralRe: C# Cursor with a rectangle? Pin
elapid6-Apr-05 10:33
elapid6-Apr-05 10:33 
GeneralProperties Problem Pin
chettu6-Apr-05 3:41
chettu6-Apr-05 3:41 
GeneralType.GetType(name) Pin
cobyjone6-Apr-05 3:34
cobyjone6-Apr-05 3:34 
GeneralRe: Type.GetType(name) Pin
Tom Larsen6-Apr-05 4:15
Tom Larsen6-Apr-05 4:15 
GeneralRe: Type.GetType(name) Pin
cobyjone6-Apr-05 4:25
cobyjone6-Apr-05 4:25 
GeneralUpload files to Server through FTP Pin
Deepa306-Apr-05 3:15
Deepa306-Apr-05 3:15 
GeneralSave and Retrieve pdf/tiff/bmp/jpg from database Pin
Deepa306-Apr-05 3:07
Deepa306-Apr-05 3:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.