473,386 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

single to string problem

Hi,

can someone help me with that, it's driving me nuts...
-----
dim s as single = 42.5
dim msg as string = s.tostring()
' now msg is supposed to hold 42.5 but NO it's rather containing 43
-----
It seems the tostring() function rounds the number but I don't
understand why it does...

thanks,
ibiza

May 5 '06 #1
2 982
try cstr()
May 5 '06 #2
Perhaps you are missing something?

Single s = 1.92345F;

Console.WriteLine(s.ToString());

returns properly?

"ibiza" <la******@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Hi,

can someone help me with that, it's driving me nuts...
-----
dim s as single = 42.5
dim msg as string = s.tostring()
' now msg is supposed to hold 42.5 but NO it's rather containing 43
-----
It seems the tostring() function rounds the number but I don't
understand why it does...

thanks,
ibiza

May 6 '06 #3

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

Similar topics

12
by: Dennis Plöger | last post by:
Hi all! I'm currently having some problems parsing a char array in c++. (And yes, I'm a half-newbie ;-)) Perhaps you can help me with this: #include <iostream> using std::cout; void...
6
by: DLP22192 | last post by:
I have the following single-line if statement that is evaluating true even though it shouldn't. I have never seen this before and I am concerned that this can happen in other areas of my code. ...
2
by: Diarmaid McGleenan | last post by:
Hi all. This isn't quite the same single/double-quote problem we see posted a multitude of times in this ng. Read on... I have a js function called ShowActiveLink which accepts a string...
5
by: Joel | last post by:
Hi, I incorporated a function in my code that whenever I use a string variable in an sql statement if the string contains a single quote it will encase it in double quotes else single quotes. ...
4
by: Lampa Dario | last post by:
Hi, I need to estract single characters in a string, that may be '0' or '1', and evaluate them. I defined these variables char *binary; char cypher; int value;
4
by: Paul | last post by:
I've got some code that adds a single quote to any ad hoc queries that appear to look like hacks. For instance, if somebody enters ' OR 1=1 -- then this code adds another single quote the string...
2
by: Mika M | last post by:
Lets say I need to do something like this when running sql-sentences... Private Sub InsertIntoTable(ByVal ProductID As Integer, ByVal Amount As Single) Dim sql as String = String.Format("INSERT...
11
by: Elmo | last post by:
Hi all! I am not very proud to ask this but here is my problem: string code = "\'13\'" The string code will have to contain following info: '51','52','63','other'... to get certain info...
3
by: Richard S | last post by:
CODE: ASP.NET with C# DATABASE: ACCES alright, im having a problem, probably a small thing, but i cant figure out, nor find it in any other post, or on the internet realy (probably cuz i wouldnt...
23
by: dkirkdrei | last post by:
I am having a bit of trouble trying to double up on slashes in a file path. What I am trying to do is very similar to the code below: <? $var =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...

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.