减法 [英] subtracting

查看:60
本文介绍了减法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我减去按钮的代码


mdcurrentresult - = txtresult.Tex

txtresult.Text = mdcurrentresult.ToString(

mbOperationbuttonPressed = Tru


现在这几乎可以减去并获得正确答案,除了它将所有内容都变为负数之外的数字除了数字之外它会变成正数。

例如

6-4 = -2应该等于

4-6 = 2应该等于 -

我可以对代码做些什么让它正常工作

另外我如何使用keypress以及我在哪里放入代码以及如何使其工作


thanx everyone

解决方案

嗨汤姆,


我没有直接看到它但是这不是真正好的代码。

你可能经常在这个新闻组中看到这里使用了后期绑定,

这使它成为一个小小的不可预测。


如果在类上面设置Option String,就会出现错误。


mdcurrentresult = mdcurrentresult - Cint(txtresult.Text)''假设你在哪里

使用整数

txtresult.Text = mdcurrentresult.ToString()

mbOperationbuttonPressed = True


当您使用VS.net并且单击设计器中的按钮时,您将创建一个点击事件。

。不是最好的,但是对于这个可用的

按键你可以在你的代码中选择下拉框中的按钮
上面的
然后在下面的rigth下拉框中的按键事件同一行。


我希望这有帮助吗?


Cor


< blockquote>嗨汤姆,


我不直接看到它然而这不是真正好的代码。

你可能经常在这个新闻组看到这里使用后期绑定,

这使得它有点不可预测。


如果在类上方设置Option String,则会出现错误。


mdcurrentresult = mdcurrentresult - Cint(txtresult.Text)''假设你在哪里

使用整数

txtresult.Text = mdcurrentresult .ToString()

mbOperationbuttonPressed = True


当您使用VS.net并点击设计器中的按钮时,它将为

您创建了一个点击事件。不是最好的,但是对于这个可用的

按键你可以在你的代码中选择下拉框中的按钮
上面的
然后在下面的rigth下拉框中的按键事件同一行。


我希望这有帮助吗?


Cor


< BLOCKQUOTE>" COR'QUOT; < no*@non.com> schrieb

如果你在你的班级上方设置了Option String,你就会收到错误。



你的妻子可能有选项字符串打开,但不是VB.NET


;-)))

-

Armin


This is the code ive got for a subtract button

mdcurrentresult -= txtresult.Tex
txtresult.Text = mdcurrentresult.ToString(
mbOperationbuttonPressed = Tru

Now this almost works it subtracts and gets the right answer apart from the fact that it turns everything into a negative number except numbers which are meant to be minus which it turns into positives.
for exampl
6-4= -2 should equal
4-6= 2 should equal -
What can I do to the code to make it work properly
Also how do I use keypress and where do I put in the code for it and how do I make it work

thanx everyone

解决方案

Hi Tom,

I do not see it directly however this is not real good code.
As you have maybe seen often in this newsgroup is here late binding used,
and that makes it a little bite unpredictable.

If you set Option String on above your class you will get an error on this.

mdcurrentresult = mdcurrentresult - Cint(txtresult.Text) ''assuming you where
using integer
txtresult.Text = mdcurrentresult.ToString()
mbOperationbuttonPressed = True

When you use VS.net and you click on the button in your designer it will for
you create a click event. Not the nicest however for this usable the
keypress you get to select in your code the button in the dropdownbox left
above and then the keypress event in the rigth dropdownbox on the same line.

I hope this helps?

Cor


Hi Tom,

I do not see it directly however this is not real good code.
As you have maybe seen often in this newsgroup is here late binding used,
and that makes it a little bite unpredictable.

If you set Option String on above your class you will get an error on this.

mdcurrentresult = mdcurrentresult - Cint(txtresult.Text) ''assuming you where
using integer
txtresult.Text = mdcurrentresult.ToString()
mbOperationbuttonPressed = True

When you use VS.net and you click on the button in your designer it will for
you create a click event. Not the nicest however for this usable the
keypress you get to select in your code the button in the dropdownbox left
above and then the keypress event in the rigth dropdownbox on the same line.

I hope this helps?

Cor


"Cor" <no*@non.com> schrieb

If you set Option String on above your class you will get an error on
this.



Your wife might have Option String On, but not VB.NET

;-)))
--
Armin


这篇关于减法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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