如何从两个组合框中添加值并在文本框中获取值并在c#winform中显示mesagebox [英] how to add values from two combo box and get value in textbox and display mesagebox in c# winform

查看:183
本文介绍了如何从两个组合框中添加值并在文本框中获取值并在c#winform中显示mesagebox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从两个组合框中减去值并在文本框中获取值并在c#winform.in中显示mesagebox c#winform plz

how to subtract values from two combo box and get value in textbox and display mesagebox in c# winform.in c# winform plz

推荐答案

这真的,真的,不是很难:

This really , really, isn''t difficult:
int i = (int)comboBox1.SelectedItem - (int)comboBox2.SelectedItem;
MessageBox.Show(string.Format("{0}:{1}", textBox1.Text, i));

这假设您使用整数加载组合框以开始......





我有两个有数字的combox,在第二个组合框的selectin值上。它应该减去第一个选择的组合框值的值,如果减去的是两个组合框的值都小于18。消息框必须显示.plz指导我



好​​的,所以这是家庭作业!

这并不比上面的代码困难得多。但既然这是你的功课,我想你应该做一些,不是吗? :笑:



在简单的阶段完成。

首先要做的是找出第二个组合框何时改变值。你知道怎么做吗?提示:查看组合框的事件。

如果有,我们将继续。

This assumes you loaded the comboboxes with integers to start with...


"i hav two combox with numbers , on selectin value of second combobox .it should subtract value of first selected combobox value and if ans of subtraction is of both combobox values is less than 18 .message box must display.plz guide me"

Ok, so it''s homework!
THis isn''t a lot harder than teh code above. But since it''s your homework, I think you should do some of it, don''t you? :laugh:

Do it in easy stages.
First thing to do is to find out when the second combobox changes value. Do you know how to do that? Hint: Look at the Events for a combobox.
When you have that, we''ll move on.


这篇关于如何从两个组合框中添加值并在文本框中获取值并在c#winform中显示mesagebox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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