Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Delete a text box

Posted on 2006-04-12
9
Medium Priority
?
216 Views
Last Modified: 2010-04-23
Hi,

Is it possibe to delete a textbox from a form programmtaically?

I was looking for something like

textbox1.remove

but could not find it.

Daz
0
Comment
Question by:yo_daz_uk
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 16439114
Try this

        TextBox1.Dispose()

Fernando
0
 
LVL 4

Expert Comment

by:sr101880
ID: 16439130
yes, it's : textbox1.dispose

let me know if you have any problems.
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 16439184
Yes sr101880 that is what I told yo_daz_uk to do.
0
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!

 
LVL 4

Expert Comment

by:sr101880
ID: 16439279
sorry, your comment wasn't on my screen when I hit submit.  No hard feelings. :-)  yo_daz_uk , Please disregard my comment.
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 16439331
No problem sr101880 and you have a great day. ;=)
0
 
LVL 9

Expert Comment

by:tolgaong
ID: 16439896
If you want to remove the textbox from the form but to use its properties anyway for any reason.
use:
 Me.Controls.Remove(TextBox1)
=> This line is valid if the textbox is placed on the form.
If it is placed on a panel or groupbox or any other container use that container's controls array

But if you want to delete the textbox not only from the form but also from the memory, then use the method that FernandoSoto and sr101880 propesed.
0
 

Author Comment

by:yo_daz_uk
ID: 16440381
Thanks its in a hast table is the also a way to empty a hash table ?
0
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 120 total points
ID: 16441252
Hi yo_daz_uk;

This code will delete all the TextBox's in the HashTable and delete all the elements in the HashTable.

        ' ht is the HashTable with TextBox.s in its array
        For Each obj As Object In ht
            Dim tb As TextBox
            ' Cast objects in the HashTable to TextBox's
            tb = CType(obj.Value, TextBox)
            ' Delete the TextBox's
            tb.Dispose()
        Next

        ' Delete all the elements in the HashTable
        ht.Clear()


Fernando
0
 

Author Comment

by:yo_daz_uk
ID: 16444134
Thanks fernado, i knew it was something basic i just couldnt find the answer!
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Screencast - Getting to Know the Pipeline
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

564 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