在列表框中的消息框中显示信息 [英] Displaying information in messagebox from listbox

查看:112
本文介绍了在列表框中的消息框中显示信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个程序,要求我从列表框中选择家庭住址.当我单击显示按钮时,将出现一个消息框,并显示该地址以及该地址的数组列表中存储的其他几位信息.我对列表框不熟悉,无法从列表框中的一个选择中找出如何在消息框中显示所有这些信息.

I am writing a program that requires me to select a home address from a listbox. When i click on the display button a messagebox is supposed to appear and display the address and several other bits of information stored in an array list for that address. I am fairly unfamiliar with listboxes and can't figure out how to display all this information in a messagebox from one selection in a listbox.

推荐答案

您可以在ListBox

string curItem = listBox1.SelectedItem.ToString();

您可以处理btn的onClick事件,然后在消息框中显示信息

you may handle the onClick event of your btn, then show information in a message box

 MessageBox.Show (curItem );

有关MessageBox的更多信息,此处

More info for MessageBox here

这篇关于在列表框中的消息框中显示信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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