"She Liked You in March. It's October Now."

Attraction runs on a clock.

She flirted for weeks. Touched your arm. Found reasons to be alone with you. And you were careful. Respectful. Waiting for the right moment.

The moment had a shelf life. It expired around month two, and by the time you asked her out, she'd quietly filed you under "little brother."

One of the hardest lessons inside the 22 Rules: women rarely wait. Interest either grows or it decays, and nothing decays it faster than a man who never moves.

Make the move while she's still inventing reasons to be near you.

Read more...

c# proyect

azrael

Don Juan
Joined
Aug 30, 2008
Messages
72
Reaction score
1
i think there are some programmers here so i am looking for a little bit of help.
i need to make a temp. converter in c# (using visual studio express 2010)

the form is : enter a value in a text box,
choose from what temp. to the other to convert using a "combo box"
for example from

Fahrenheit to Celsius. and when you press a "execute button" the conversion would display in another textbox

but i am having troubles doing it, my approach was


if (comboBox1.Text == "FAHRENHEIT A CELSIUS")
{

a =Convert.ToInt32( textbox1.Text);
c= (a - 32) / 1.8;
textbox2.Text = c.ToString();
}

but that is not working . i made a calculator using something like that.

if you guys can point me in the right direction it would be much appreciated
 

"So, What Do You Do for Fun?"

She asks it casually, mid-sip. And you feel the floor open up, because the honest answer is work, gym, and a couple shows you're half-watching.

Women rarely say this out loud, but a man with a life is attractive before he says a word. The guy who spent Saturday deep-sea fishing and came back with photos and a story — he walks in already interesting.

The "22 Rules" pushed me to build a life worth talking about. Turns out the fastest way to be interesting to women is to be interested in your own life first.

Read more...

mikeyb

Senior Don Juan
Joined
May 10, 2007
Messages
472
Reaction score
16
Age
38
Location
UK
Trying to use int32 type for floating point operations (i.e. decimals) will produce problems because int32 only stores integers. Use the "double" type instead.
 

synergy1

Master Don Juan
Joined
Sep 22, 2006
Messages
1,984
Reaction score
192
mikeyb said:
Trying to use int32 type for floating point operations (i.e. decimals) will produce problems because int32 only stores integers. Use the "double" type instead.
In C, you can use both i believe, int32 would likely only truncate the answer by removing trailing decimals and rounding, not cause an compile error but will clearly be a runtime error.

Also not sure on the rules of C#, if you have an int in an equation and divide by a double, will the result convert to an int or a double? Had a lot of runtime errors based on passing integers through functions and having them convert or drop decimal places.
 

Teflon_Mcgee

Master Don Juan
Joined
Apr 3, 2006
Messages
918
Reaction score
27
Besides the whole int32 vs. double (which shouldn't be that big of a deal in c#)
there is also this

comboBox1.Text == "FAHRENHEIT A CELSIUS"


A more proper way would be to use any of the following:


1. if(comboBox1.Text.CompareTo("FAHRENHEIT A CELSIUS") == 1);
2. if(String.Compare(comboBox1.text, "FAHRENEHEIT A CELSISU") == 1);
3. if(comboBox1.Text.Equals("FAHRNEHEIGHT A CELSIUS") == 1);
 

azrael

Don Juan
Joined
Aug 30, 2008
Messages
72
Reaction score
1
thank you so much!!!!!

i just needed to change the way i was declaring the value for the program to run


up here i did not pust it but it was a:

int a=0,c=0;
i just needed to change the int for double


if (comboBox1.Text == "FAHRENHEIT A CELSIUS")
{

a =Convert.ToInt32( textbox1.Text);
c= (a - 32) / 1.8;
textbox2.Text = c.ToString();



and +1 to you guys

}
 

"So, What Do You Do for Fun?"

She asks it casually, mid-sip. And you feel the floor open up, because the honest answer is work, gym, and a couple shows you're half-watching.

Women rarely say this out loud, but a man with a life is attractive before he says a word. The guy who spent Saturday deep-sea fishing and came back with photos and a story — he walks in already interesting.

The "22 Rules" pushed me to build a life worth talking about. Turns out the fastest way to be interesting to women is to be interested in your own life first.

Read more...

Huffman

Master Don Juan
Joined
Oct 29, 2007
Messages
1,499
Reaction score
166
Teflon_Mcgee said:
A more proper way would be to use any of the following:


1. if(comboBox1.Text.CompareTo("FAHRENHEIT A CELSIUS") == 1);
2. if(String.Compare(comboBox1.text, "FAHRENEHEIT A CELSISU") == 1);
3. if(comboBox1.Text.Equals("FAHRNEHEIGHT A CELSIUS") == 1);
As long as he's staying with C#, the == will do just fine. The whole reference vs value comparison is an ugly thing and I agree that for good style you should always use Equals, but just saying that in C# the == operator is overloaded for equals.

In Java it wouldn't work however I think... makes for alot of ugly bugs.
 

Teflon_Mcgee

Master Don Juan
Joined
Apr 3, 2006
Messages
918
Reaction score
27
Huffman said:
As long as he's staying with C#, the == will do just fine. The whole reference vs value comparison is an ugly thing and I agree that for good style you should always use Equals, but just saying that in C# the == operator is overloaded for equals.

In Java it wouldn't work however I think... makes for alot of ugly bugs.

Yes, that's why C# is so awesome. Any Windows utility I make I ALWAYS do in C# (where I used to use Java as it's easier to do GUI's than C++.)

But I'm a hardware guy so I spend my time in assembly and C, unfortunately.
 
Top