Click here to Skip to main content
15,891,976 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have two textboxes and one button.in one textbox1 i am inserting decimal value and it is converting into words. my codes are below. but when i am inserting int or string into textbox one then it is throwing errors.
i want one message box should be display when i sent int or string inside the textbox one.

C#
if ("" == feespaybletothecounsel.Text )
         {
             MessageBox.Show("please check");
         }
         else
         {
             string convertys = ConverttoWords(Convert.ToInt32(feespaybletothecounsel.Text));
             if (convertys == "" )
             {
                 feespaybletothecounsel.Text = "";
             }
             feespaybletothecounsel1.Text = convertys;
         }
Posted
Comments
Sergey Alexandrovich Kryukov 4-Jun-15 2:59am    
This is pretty easy but depends on what is your text box type. I guess, type name is TextBox, but which one? Full type name, please.
—SA

1 solution

use int.TryParse
C#
int val;
if(!int.TryParse(feespaybletothecounsel.Text, out val)
{
    MessageBox.Show("please check");
}else
{
     feespaybletothecounsel1.Text = ConverttoWords(val);
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900