Complex calculation based on selection

U

UKDeluded

Okay, bear with me on this, would love to get it working!
You have a set of three option buttons. One has the value of 20, one 40, and
one 0. Under that is a date field. If option 1 is selected, the date field
needs to take the date from another field and add the value (20 days) to it.
If second option, 40 days, if third option, it is open for the user to select
the date. If options one and two are selected, 20 days again.
Any clues? I just keep banging my head and it's starting to hurt!
 
M

Michelle

You'll have to write some code in the OnAfterChange event for the radio
buttons that will update the value in the date field. Something like the
following where field7 is bound to three radiobuttons whose values are 20, 40
and 0 and field8 stored the date:
if (e.Operation == "Insert")
{
if (Convert.ToInt32(e.NewValue) != 0)
{
IXMLDOMNode nddate =
thisXDocument.DOM.selectSingleNode("/my:myFields/my:field8");
string date = nddate.text;
DateTime mydate = DateTime.Today();
mydate = mydate.AddDays(Convert.ToDouble(e.NewValue));
nddate.text = mydate.ToString();
}
else
{
thisXDocument.DOM.selectSingleNode("/my:myFields/my:field8").text =
DateTime.Today.ToString();
}
}
 
U

UKDeluded

I'm off doing fun stuff for a few days so will try this next week. Thanks for
the reply!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top