كيف احول القيمه الموجوده في متغير نصي الى قيمه عددية
مثلا القيمة الموجوده في مربع نص كيف اعمل عليها عمليات حسابية
ومشكورين مسبقا ياشباب
كيف احول القيمه الموجوده في متغير نصي الى قيمه عددية
مثلا القيمة الموجوده في مربع نص كيف اعمل عليها عمليات حسابية
ومشكورين مسبقا ياشباب
Hello Mimi,
If you have a text box textBox1 and wants to do some calculation on it,you just need to convert its Text property to integer using the Convert class :
Example:
int m = Convert.ToInt32(textBox1.Text) ;
the ToInt32 method converts the text to an integer.You can also convert to long using the ToInt64 or to short using ToInt16.
Convert.ToInt16(textBox1.Text) ;
Convert.ToInt64(textBox1.Text) ;
Or to a double
Convert.ToDouble(textBox1.Text) ;
Check the MSDN documentation for a list of all the supported conversion methods.
Tahiyati
Madani
شكرا لك اخ مدني
أخي لماذا تكتب بلاجليزي ... أنا ما اعرف ايش تقول :D
وشكراً
If you think yourself that you are nobody, you should go somewhere to find yourself
I will be writing in Arabic soon.
;) ;)
Is this Arabic ? :
اقتباسوالى الفتفسار اكثر راسنا
;);)
You are veray good into the english(f)
أنا قلت الي اعرفه بلe
شكراً لك
If you think yourself that you are nobody, you should go somewhere to find yourself
1ستعمل دالة كونفرت مثلا :
int n;
n=Convert.ToInt16("123")وبدلك يخصص للان قيمة 123 ونوعها int (عدد)
هذا الموضوع مغلق.