By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,741 Members | 2,004 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,741 IT Pros & Developers. It's quick & easy.

Strange problem

P: n/a
Hello group

I have a strange problem. I have a panel. On this panel, I can drop custom
Textbox that I create at runtime. I have a toolbar on witch a delete button
exist. When I click on this button, the application delete the select
Textbox on the panel. I allso give the ability to the Texbox to contains
others Textbox. That mean that my fonction is recursiv.

This is the code when I clik on the delete button

'I check is I have something selected
If Not mobjItemDragDrop Is Nothing Then
'mobjItemDragDrop is the selected Textbox on my
Panel or in an other Texbox
mpDelete(mobjItemDragDrop, mobjItemDragDrop.Parent)

End If

Here is my fonction that I call when I delete something

Private Sub mpDelete(ByRef sender As Control, ByRef senderParent As Control)

Const METHODE As String = "mpDelete"

Dim objItem As clsCustomTB

If sender.Controls.Count > 0 Then
For Each objItem In sender.Controls

If objItem.Controls.Count > 0 Then
mpDelete(objItem, objItem.Parent)
End If








End If

Catch ex As Exception
System.Reflection.Assembly.GetExecutingAssembly.Lo cation, CLASSE, METHODE,
System.Windows.Forms.SystemInformation.ComputerNam e,
System.Windows.Forms.SystemInformation.UserName, True)

End Try

End Sub

The strange Thing is when I check the Count property it is equal to 0 but on
my panel or in my Textbox, I can still see the control that have been
remove. I want to know what I am doing wrong here? Why the count is equal
to 0 but the control still exist? Is there a better way to remove a control
from it parent's?

Thank you
Marc R.
Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.