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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can get the selected item value in a ListBox
string curItem = listBox1.SelectedItem.ToString();
you may handle the onClick
event of your btn, then show information in a message box
MessageBox.Show (curItem );
More info for MessageBox here