Advertisement
King_96

Button show listbox C#

Jan 25th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 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 WindowsFormsApplication11
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void button1_Click(object sender, EventArgs e)
  21.         {
  22.             AddMyGroupBox();
  23.         }
  24.         private void AddMyGroupBox()
  25.         {
  26.             // Create a GroupBox and add a TextBox to it.
  27.             ListBox listBox1 = new ListBox();
  28.             listBox1.BringToFront();
  29.             listBox1.Location = new Point(330, 0);
  30.             listBox1.Size = new Size(750, 350);
  31.             listBox1.Items.Add("Starting to get good");
  32.  
  33.             // Set the Text and Dock properties of the GroupBox.
  34.            
  35.            
  36.  
  37.             // Disable the GroupBox (which disables all its child controls)
  38.             button1.Enabled = false;
  39.  
  40.             // Add the Groupbox to the form.
  41.             this.Controls.Add(listBox1);
  42.         }
  43.  
  44.  
  45.  
  46.  
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement