Friday, February 4, 2011

This is some code that allows you to add buttons, labels, textbox, and listbox

     Dim Button1 As New Button  
     Dim textbox1 As New TextBox  
     Dim label1 As New Label  
     Dim listbox1 As New ListBox  
   
     Button1.Text = "Go"  
     Me.Controls.Add(Button1)  
   
     textbox1.Text = "Hello"  
     textbox1.BackColor = Color.Chocolate  
     Me.Controls.Add(textbox1)  
   
     label1.Text = "Good Morning"  
     label1.BackColor = Color.Aqua  
     Me.Controls.Add(label1)  
   
     listbox1.BackColor = Color.Black  
     listbox1.Location = New System.Drawing.Point(77, 162)  
     Me.Controls.Add(listbox1)  

First you have to declare then control then from there you have to set what ever you want like the size, back color, or any thing like that. Once you done with that you have to follow it with a Me.Controls.Add() to add it to the form.

No comments:

Post a Comment