private void moneyLegalStyleToolStripMenuItem_Click(object sender, EventArgs e) { string selectedtext = AddUtilities.getSelectedText(wp); if (String.IsNullOrEmpty(selectedtext)) // if there is no text selected, open up NumberToTextForm { NumberToTextForm convertNumberForm = new NumberToTextForm(wp, 1); convertNumberForm.ShowDialog(); } else { Decimal result; // try to parse the number. If it is no good, it gets ignored if (Decimal.TryParse(selectedtext, NumberStyles.Currency, CultureInfo.CurrentCulture, out result)) { AddUtilities.ConvertNumberToMoney(wp, result); } } }
private void numberToTextToolStripMenuItem_Click(object sender, EventArgs e) { string selectedtext = AddUtilities.getSelectedText(wp); if (String.IsNullOrEmpty(selectedtext)) { NumberToTextForm convertNumberForm = new NumberToTextForm(wp, 2); convertNumberForm.Show(); } else { Decimal result; if (Decimal.TryParse(selectedtext, NumberStyles.Number, CultureInfo.CurrentCulture, out result)) { AddUtilities.ConvertNumberToText(wp, result); } } }