need help...

  • Thread starter Thread starter Corey Dyke
  • Start date Start date
C

Corey Dyke

K here's the situation, attached is a copy of the lab i have due next week.
But I won't be around for the next few days, so I 've gotta get it done
ASAP. but it's driving me crazy.

We have to design a windows application for children to use for simple
arithmetic. They must have an option button to bring up a modal dialog
which allows them to choose non-zero single digit numbers, double digit
numbers, or one of each. They can also specify a seed for the random number
generator. The application also has to validate any numbers received.

Here are the problems i'm having with it:

label_Click method: when you click on the label it's supposed to cycle
between +. -. * and / I can't seem to get this to work no matter what I try.

All in all I can't really pick heads nor tails of how to go about it. Going
to spend time tomorrow with my instructor, to see if he can clarify what i
need. But thought I'd look for help on here too, as I've gotten good help
here before.

Also, i'm not looking for people to give me code, but just to point me in
the right direction with a good explanation, or a point to a good resource.

Thanks,

Corey
 
Hi,

You problem is not clear and the attachement also not there...
but ....

label_Click method: when you click on the label it's supposed to cycle
between +. -. * and / I can't seem to get this to work no matter what I try.

for this you can do some thing like this

define this global pointer variable
private int lintMyPoint = 0;

define this string array as well
private string[] larstrMyData = new string[] {"*", "+", "-" etc}

in you a label_Click()
{
if (larstrMyData.Length > lintMyPoint)
lintMyPoint ++;
else
lintMyPoint = 0;
label.Text = larstrMyData[lintMyPoint];
}

If I got it correctly this way it should solve it

Nirosh.
 
Thanks for the tip, however i did get it working. I just put the label Text
into a buffer and used if statements to check it and change it where
necessary.

yeah for some reason my attachement wouldn't show up...

here is what my assignment says:

Create a C# application for children to practice basic arithmetic. The main
form in the application resembles the following:

"number 1"
operator "number 2"
"answer box" "option button"

When the option button is clicked, a present a modal dialog to allow the
user:
- to choose non zero single digit numbers, double digit numbers, or one of
each
- to specify a seed of the random number generator so as to have a
different set of numbers.

In addition, your application needs to validate any numbers received.

the main problem i have now is....

how do i pass data from my second form, "options", Each of these options
should directly affect the main form when they are chosen, and then OK is
clicked. if Cancel is clicked, the changes to not take place.

i have 2 radio buttons set up for each number (singe digit or double digit)

also, how do I get the numbers to add/sub/multiply/divide together depending
on what the sign is?

i'm still quite a bit lost on the rest...

thanks

Corey


Champika Nirosh said:
Hi,

You problem is not clear and the attachement also not there...
but ....

label_Click method: when you click on the label it's supposed to cycle
between +. -. * and / I can't seem to get this to work no matter what I try.

for this you can do some thing like this

define this global pointer variable
private int lintMyPoint = 0;

define this string array as well
private string[] larstrMyData = new string[] {"*", "+", "-" etc}

in you a label_Click()
{
if (larstrMyData.Length > lintMyPoint)
lintMyPoint ++;
else
lintMyPoint = 0;
label.Text = larstrMyData[lintMyPoint];
}

If I got it correctly this way it should solve it

Nirosh.
Corey Dyke said:
K here's the situation, attached is a copy of the lab i have due next week.
But I won't be around for the next few days, so I 've gotta get it done
ASAP. but it's driving me crazy.

We have to design a windows application for children to use for simple
arithmetic. They must have an option button to bring up a modal dialog
which allows them to choose non-zero single digit numbers, double digit
numbers, or one of each. They can also specify a seed for the random number
generator. The application also has to validate any numbers received.

Here are the problems i'm having with it:

label_Click method: when you click on the label it's supposed to cycle
between +. -. * and / I can't seem to get this to work no matter what I try.

All in all I can't really pick heads nor tails of how to go about it. Going
to spend time tomorrow with my instructor, to see if he can clarify what i
need. But thought I'd look for help on here too, as I've gotten good help
here before.

Also, i'm not looking for people to give me code, but just to point me in
the right direction with a good explanation, or a point to a good resource.

Thanks,

Corey
 
Of course it is practise that makes perfect, good to NOT just ask for a full
solution. May I say using if - then to check for the current string (if
that's what you meant) and change it to the next value works but is far from
elegant imho. Using a String [] or enum would probably be both more easy to
read and to code... Resetting the string counter to 0 could also be achieved
by using the % operator. May not be faster (don't know really) but very
easily coded!

Best!
Stu


Corey Dyke said:
Thanks for the tip, however i did get it working. I just put the label Text
into a buffer and used if statements to check it and change it where
necessary.

yeah for some reason my attachement wouldn't show up...

here is what my assignment says:

Create a C# application for children to practice basic arithmetic. The main
form in the application resembles the following:

"number 1"
operator "number 2"
"answer box" "option button"

When the option button is clicked, a present a modal dialog to allow the
user:
- to choose non zero single digit numbers, double digit numbers, or one of
each
- to specify a seed of the random number generator so as to have a
different set of numbers.

In addition, your application needs to validate any numbers received.

the main problem i have now is....

how do i pass data from my second form, "options", Each of these options
should directly affect the main form when they are chosen, and then OK is
clicked. if Cancel is clicked, the changes to not take place.

i have 2 radio buttons set up for each number (singe digit or double digit)

also, how do I get the numbers to add/sub/multiply/divide together depending
on what the sign is?

i'm still quite a bit lost on the rest...

thanks

Corey


Champika Nirosh said:
Hi,

You problem is not clear and the attachement also not there...
but ....

label_Click method: when you click on the label it's supposed to cycle
between +. -. * and / I can't seem to get this to work no matter what I try.

for this you can do some thing like this

define this global pointer variable
private int lintMyPoint = 0;

define this string array as well
private string[] larstrMyData = new string[] {"*", "+", "-" etc}

in you a label_Click()
{
if (larstrMyData.Length > lintMyPoint)
lintMyPoint ++;
else
lintMyPoint = 0;
label.Text = larstrMyData[lintMyPoint];
}

If I got it correctly this way it should solve it

Nirosh.
Corey Dyke said:
K here's the situation, attached is a copy of the lab i have due next week.
But I won't be around for the next few days, so I 've gotta get it done
ASAP. but it's driving me crazy.

We have to design a windows application for children to use for simple
arithmetic. They must have an option button to bring up a modal dialog
which allows them to choose non-zero single digit numbers, double digit
numbers, or one of each. They can also specify a seed for the random number
generator. The application also has to validate any numbers received.

Here are the problems i'm having with it:

label_Click method: when you click on the label it's supposed to cycle
between +. -. * and / I can't seem to get this to work no matter what
I
try.
All in all I can't really pick heads nor tails of how to go about it. Going
to spend time tomorrow with my instructor, to see if he can clarify
what
 
Back
Top