ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm trying to make a program to simulate a parabolic movement, so i've added 2 entries, one for the initial velocity and other for the angle, anyway you probably don't care about that xD
what i want is to take the number entered in the entry and put it in a variable to do the math, and then show everything in a dialog or something.
how do i do that?
Depends on what language you're using. In C or C++ you can use the atof or sscanf functions to convert the string to a double value. Most scripting languages (Perl, Python) will automatically convert it for you. Other languages have other methods.
Depends on what language you're using. In C or C++ you can use the atof or sscanf functions to convert the string to a double value. Most scripting languages (Perl, Python) will automatically convert it for you. Other languages have other methods.
OH! sorry i forgot that, the language is actually C#. I really dont like c# that much (micro$oft) but thats my assignment so...
In that case, you should be able to just call GetText() on one entry to get what the user typed as a string, then use whatever conversion function C# provides to convert it to an int/double/whatever (sorry, not a C# programmer). Repeat with the other entry, and you have your two numbers to do the math with.
Showing the result is similar. If you just want distance traveled (for instance), just add a label to the dialog, and set its Text property to the answer. If you're trying to make a graph, that's a little harder. You'll have to use a DrawingArea for that.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.