Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Removing a control

Posted on 2004-09-18
5
Medium Priority
?
181 Views
Last Modified: 2010-04-23
Hi

I've added a button during runtime.
But when I try to remove it again, it won't go away

Code:

        Dim btnhuidig As Button = sender
        If txthuidig.Text Like "*@*.*" Then
            mstrEmail(1, txthuidig.Tag) = txthuidig.Text
            Me.Controls.Remove(btnhuidig)
        Else

I've tried also with Me.Refresh
Anyone has an idea?
0
Comment
Question by:Schuppex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 

Expert Comment

by:cheese_ontoast
ID: 12091633
Can you paste the code that created the button and maybe a bit more code to do with the 'sender' variable?

Otherwise the removal of a runtime created button should be easy enough...

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim myNewButton As New Button
        myNewButton.Name = "btnTest"
        myNewButton.Text = "TEST"
        Me.Controls.Add(myNewButton)
        AddHandler myNewButton.Click, AddressOf Me.NewButtonClick
    End Sub

    Private Sub NewButtonClick(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Controls.Remove(sender)
    End Sub
0
 
LVL 8

Accepted Solution

by:
wguerram earned 500 total points
ID: 12092823
Did you check if it is getting in the if condition?.

I tried and it works.

Try this without the conditions:

        Dim btnhuidig As Button = sender
        Me.Controls.Remove(sender)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question