Omega192

ListView ItemChanged puzzle with MessageBoxes - ItemSelectio

Jun 8th, 2011
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. public partial class Form1 : Form
  2.     {
  3.         public Form1()
  4.         {
  5.             InitializeComponent();
  6.         }
  7.  
  8.         private bool ShowMessageBox()
  9.         {
  10.             return MessageBox.Show("Change to first item instead?", "test", MessageBoxButtons.YesNo) == DialogResult.Yes;
  11.         }
  12.  
  13.         private void listView1_Click(object sender, EventArgs e)
  14.         {
  15.             if (ShowMessageBox())
  16.                 listView1.TopItem.Selected = true;
  17.                 label1.Text += "item selected   ";
  18.         }
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment