Results 1 to 12 of 12

Thread: Removing Controls At Run Time

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2011
    Posts
    19

    Removing Controls At Run Time

    I Put together this bit of code. What the problem im having is Removing a Label after i place the code its in a select end slecte code . The Problem is in red.

    the code

    Code:
    
    
            Dim Animals As String = (TextBox1.Text)
            Select Case Animals
    
                Case "Apples"
    
    
          Dim userinput1 As Integer = InputBox("Enter The Farm X Location")
                 Dim userinput2 As Integer = InputBox("Enter The Farm Y Location")
                 Dim userinput3 As Integer = InputBox("Enter The Farm Widgth Size")
                 Dim userinput4 As Integer = InputBox("Enter The Farm Hidgth Size")
                    Dim userinput5 As String = InputBox("Please Choose Farm Name")
                    Dim LB As New Label()
                    LB.Name = userinput5
                    Me.Controls.Add(LB)
                    LB.Location = New Point(userinput1, userinput2)
                    LB.Size = New Size(userinput3, userinput4)
                    LB.BackColor = Color.Red
                    LB.Text = "Apples"
    
    
    
                Case "Sell"
    
           Dim userinput1 As String = InputBox("Please Choose A Orchard To Sell")
           Dim LB As New Label()
            Me.Controls.Remove(LB)
           LB.Name = userinput1
     
       
    End Select

    Everything works Accept the remove selection ... I think it has something to do with Dim LB As New Label() ... And ... Me.Controls.Remove(LB)
    Last edited by JAC81FTW; Jun 12th, 2011 at 05:49 PM. Reason: Typo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width