By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,504 Members | 1,143 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,504 IT Pros & Developers. It's quick & easy.

format exception was unhandled"

P: 33
Expand|Select|Wrap|Line Numbers
  1. float[] x = new float[10000];
  2. float[] y = new float[10000];
  3. int c=0;
  5. using (StreamReader sr = new StreamReader("e: \\CuPeak.dat"))
  6. {
  8. while (!sr.EndOfStream)
  9. {
  11. string s = sr.ReadLine();
  13. string[] variables = s.Split(' ');
  14. x[c] = float.Parse(variables[0]);//run time ERROR in this line " format exception was unhandled"
  15. y[c] = float.Parse(variables[1]);
  16. Console.WriteLine(x[0]);
  17. }
Nov 15 '09 #1
Share this Question
Share on Google+
4 Replies

Expert 2.5K+
P: 3,525
I know you have been told this before: Please put [code] tags around your code in posts. Stop being lazy and expecting others to do it for you.
Nov 16 '09 #2

Expert 2.5K+
P: 3,525
There is no question in your post. What are you asking of the volunteers here?
Nov 16 '09 #3

P: 33
There is nothing being lazy, the only thing is that i thought its better to write point 2 point, so i didnt wrote much. but in line no. 14 the question was mentioned. Also, i should have mentioned that at top to highlight it.
sorry to confuse you
Nov 16 '09 #4

Expert 100+
P: 427
Create a break point and step through the code, inspect the value varialbles[0], i'm pretty sure you'll see that it is not a float, this is why you get an error, the value provided cannot be converted into a float.
Nov 16 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.