将表达式的值保存在文本框中 [英] save the value of expression in a textbox

查看:53
本文介绍了将表达式的值保存在文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,

在下面的代码中,如何将expression的值(我在那里评论)保存到文本框中?
谢谢.

Hi friends,

in the code below how can I save the value of expression (I commented there) into a textbox?
Thanks.

public double bigzarb(double u,double v)
     {
         double n;
         double x=0;
         double y;
         double w=0;
         double z;
         string[] i = textBox7.Text.Split(',');
         int[] nums = new int[i.Length];
         for (int counter = 0; counter < i.Length; counter++)
         {
             nums[counter] = Convert.ToInt32(i[counter]);
         }
         u = nums[0];
         double firstdigits =Math.Floor(Math.Log10(u) + 1);
          v = nums[1];
         double seconddigits = Math.Floor(Math.Log10(v) + 1);
         if (firstdigits >= seconddigits)
         {
             n = firstdigits;
         }
         else
         {
             n = seconddigits;
         }
         if (u == 0 || v == 0)
         {
             MessageBox.Show("the Multiply is 0");
         }
         int intn = Convert.ToInt32(n);
         if (intn <=3)
         {
             double uv = u * v;
             string struv = uv.ToString();
             MessageBox.Show(struv);
             return uv;
         }
         else
         {
            int m  =Convert.ToInt32(Math.Floor(n / 2));
             x = u % Math.Pow(10,m);
             y = u / Math.Pow(10, m);
             w = v % Math.Pow(10,m);
             z = v / Math.Pow(10,m);
             return  bigzarb(x, w) *Math.Pow(10,m)+ (bigzarb(x,w)+bigzarb(w,y))*Math.Pow(10,m) +bigzarb(y,z);
///how can i show the value  of the line above in a textbox?
         }
     }

推荐答案

是您想要的吗?

Is that what you want?

double result = bigzarb(x, w) *Math.Pow(10,m)+ (bigzarb(x,w)+bigzarb(w,y))*Math.Pow(10,m) +bigzarb(y,z);
textBox1.Text = result.ToString()
return result;


尝试一下,
Try this,
textBox1.Text = bigzarb(1.0,2.0)


传递uv值.


Pass the u and v value.


这篇关于将表达式的值保存在文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆