Advertisement
Fhernd

Principal.cs

Feb 27th, 2018
1,352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. using System;
  2. using System.Windows.Forms;
  3.  
  4. namespace R707DesplazarListBox
  5. {
  6.     public partial class Principal : Form
  7.     {
  8.         public Principal()
  9.         {
  10.             InitializeComponent();
  11.         }
  12.  
  13.         private void btnAgregarElementos_Click(object sender, EventArgs e)
  14.         {
  15.             for (int i = 1; i <= 20; i++)
  16.             {
  17.                 lbxElementos.Items.Add("Elemento no. " + i.ToString());
  18.             }
  19.            
  20.             lbxElementos.TopIndex = lbxElementos.Items.Count - 1;
  21.             lbxElementos.SelectedIndex = lbxElementos.Items.Count - 1;
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement