-C#- Numeric Input - Printable Version +- (wL) Forums (https://war-lords.net/forum) +-- Forum: Resources (https://war-lords.net/forum/forum-31.html) +--- Forum: Programming (https://war-lords.net/forum/forum-33.html) +--- Thread: -C#- Numeric Input (/thread-5029.html) |
-C#- Numeric Input - MindHACKer - Nov 20 2011 How to make it possible to use different Numeric Variables in the Input process: As we all know the only control that could be used to enter input like "Characters & Numbers & ..etc" is the Text-box, the problem is that the program cant process mathematics processes because he thinks that the Text-box is a String only, that's why you get an error when you sub 2 numbers or divide others. ..this is a Sample on how to solve the issue: Code: float doc = Convert.ToSingle(textBox1.Text) / Convert.ToSingle(textBox3.Text); So the main idea is to convert it back to string in the end. Here is a full "Simple Calculator" i made from scratch... Code: using System; RE: -C#- Numeric Input - Helices - Nov 29 2011 I need to sharpen up on c#.. I'd have used type-casting for this in a C based program! But clearly there are some large differences in programing styles.! This would prove quite useful! Thanks! RE: -C#- Numeric Input - MindHACKer - Nov 29 2011 Helices Wrote:I need to sharpen up on c#..NP, Glad I could help. |