Guest User

Form1.cs

a guest
Jan 3rd, 2017
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApplication1
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.  
  19.             for (int i = 0; i < 10; ++i)
  20.             {
  21.                 exampleListBox.Items.Add(i);
  22.             }
  23.            
  24.         }
  25.  
  26.         private void exampleButton_Click(object sender, EventArgs e)
  27.         {
  28.             exampleListBox.Items[exampleListBox.SelectedIndex] = exampleListBox.Items[exampleListBox.SelectedIndex];
  29.         }
  30.  
  31.         private void exampleListBox_SelectedIndexChanged(object sender, EventArgs e)
  32.         {
  33.             Console.WriteLine(exampleListBox.SelectedIndex);
  34.         }
  35.     }
  36. }
Add Comment
Please, Sign In to add comment