YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Delete a symbol from a display using VBA Options · View
vegard
#1 Posted : Tuesday, December 27, 2011 2:41:27 PM
Rank: Newbie
Groups: Member

Joined: 12/27/2011
Posts: 2
Adding a symbol to a ProcessBook display is done with the following VBA code:

Code:
Dim MySymbol As Symbol
Set MySymbol = ThisDisplay.Symbols.Add(pbSymbolTBSymbol)


My question is thus: How can it be removed?

A pbSymbol does not have a .Remove() method as far as I know. Is there another way?

My workaround is to simply to remove the visibility of the symbols, but this is a rather poor solution in my humble opinion.
Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
jhcoxx
#2 Posted : Thursday, December 29, 2011 10:44:25 PM
Rank: Member
Groups: Member

Joined: 7/5/2010
Posts: 27
Location: Texas
Here's a snippet of code from something I'm working on:

Dim aSymb as Symbol
Dim bStat as Boolean

For Each aSymb In ThisDisplay.Symbols
If aSymb.Top > lTop And aSymb.Left < lLeft Then
bStat = ThisDisplay.Symbols.Remove(aSymb.Name)
End If
Next aSymb

The relevant part to your question is the line

bStat = ThisDisplay.Symbols.Remove(aSymb.Name)

The Symbols.Remove method returns a Boolean status where True = success and False = failure to remove the symbol.

Hope this helps...

jhcoxx
vegard
#3 Posted : Friday, December 30, 2011 6:52:21 AM
Rank: Newbie
Groups: Member

Joined: 12/27/2011
Posts: 2
Thanks for the clarification.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.