Noob need help with C programing problem

Mar 19, 2003
18,289
2
71
I don't have much experience with C# or any experience with forms as such, but you should be using a double equals (==) for that comparison in the if statement...single equals is an assignment statement, which of course isn't what you want in this case.
 

dighn

Lifer
Aug 12, 2001
22,820
4
81
not to nitpick (ok I do) but C is an entirely different beast from C#
in C/C++ that code would compile but when it runs it'll make you go WTF from the unexpected results
 
Sep 29, 2004
18,656
68
91
Originally posted by: kamper
Oh come on, do you really need that explained? :roll:

Cocnur,.

Getting answers here will teeach you nothing.

The journey will teech you the answer to your probelm and many other things you didn't know already.

Serously, if you don't want to learn this on your own, just change majors.
 

Jaxidian

Platinum Member
Oct 22, 2001
2,230
0
71
twitter.com
I'll help you in a way that will also help you learn.

Run the following lines of code one-at-a-time and see what results you get:


MessageBox.Show(int.Parse("superman").ToString());
MessageBox.Show(int.Parse("one").ToString());
MessageBox.Show(int.Parse("34.5").ToString());
MessageBox.Show(int.Parse("34").ToString());
MessageBox.Show(DateTime.Parse("superman").ToString());
MessageBox.Show(DateTime.Parse("today").ToString());
MessageBox.Show(DateTime.Parse("Christmas").ToString());
MessageBox.Show(DateTime.Parse("1/1").ToString());
MessageBox.Show(DateTime.Parse("1/1/01").ToString());
MessageBox.Show(DateTime.Parse("1/1/1901").ToString());
MessageBox.Show(DateTime.Parse("1/1/2001").ToString());
MessageBox.Show(DateTime.Parse("1-1-2001").ToString());
MessageBox.Show(DateTime.Parse("1.1.2001").ToString());
MessageBox.Show(DateTime.Parse("January 1, 2001").ToString());

If you understand what happens and why with these, then you'll have your questions answered.

-Jax
 

UCJefe

Senior member
Jan 27, 2000
302
0
0
So did you click any of those links VS.NET so helpfully offered you? One of the major parts of programming has nothing to do with writing code and everything to do with learning how to find and read documentation on your own. It's much better to learn these techniques now then when you're in the business world harassing your co-workers who have a hard enough time doing their own job and don't want to do yours. As a breed, we are more than happy to assist if you've done some legwork first and still aren't understanding things but just posting compile/runtime errors is generally not received well.

Here's a hint... what could "Input string is not in the correct format" be trying to tell you? In your own words, what is the double.Parse() method trying to do?