Print Page | Close Window

Adding / Removing Groups at Run Time

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Task Panel
Forum Description: Topics Related to Codejock Task Panel
URL: http://forum.codejock.com/forum_posts.asp?TID=16119
Printed Date: 27 June 2025 at 10:22pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Adding / Removing Groups at Run Time
Posted By: dexatron
Subject: Adding / Removing Groups at Run Time
Date Posted: 01 February 2010 at 7:25pm
Hi,
 
I am adding new group with items based on what item is clicked in my top group.
 
I am trying to remove this dynamic group before adding the new group if a different item is clicked on.
 
My problem is that I can seem to remove the existing group.  I can't seem to identify it:
 
'this code fails
If tp1.Groups.Find(2) Then
  tp1.Groups.Remove (tp1.Groups(2))
End If
 
' this is the add code on item click that works fine
 
Set group = tp1.Groups.Add(2, "My Calendar")
group.Items.Add 1, "Weigh In", xtpTaskItemTypeLink, 0
 
thanks for any help



Replies:
Posted By: dexatron
Date Posted: 02 February 2010 at 9:08am
There has to be a better way, but this is how I have it working at the moment:
 
If Item.Group.Id = 1 Then
  If tp1.Groups.Count > 2 Then   ' remove the dynamic group if it exists
    tp1.Groups.Remove (tp1.Groups.Count)
  End If
 
  Select Case (Item.Index - 1)
  
  Case 0
    Set Group = tp1.Groups.Add(2, "My Calendar")
    Group.Items.Add 1, "Weigh In", xtpTaskItemTypeLink, 0
  Case 1....
 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net