Hi all im after a piece of code that allows the user to enter a fraction e.g 1/4 and have the code split that fraction into 2 seperate variables, e.g
variable 1 containing the '1'
variable 2 cantaining the '4'
How would i achive this?
My objective is to make a calculator for horse racing that will work out the payout for your horse, any ideas?
Take it into a string and parse everything (either with your own function that multiplies out the place values or something like atoi) up to the slash as one integer and parse everything after as a second integer.
Or a simple way to do it would be have the user input the numerator, print out a slash and have them put in the denominator.
Or you could ask for a string and then get the string length then make a for loop that would save every number before the slash and after the slash to an extern string and then convert it to an integer.
Anyways this are my 2 ways of solving it, there might be more and better ones out there but I only know this ones :). Hope it helped.
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...