GdPicture.NET Reference Guide
TagCount Method (GdViewer)
Example 





GdPicture14.WPF Namespace > GdViewer Class : TagCount Method
Returns the total number of tags (EXIF, IPTC, Extra, Thumbnails & GPS, XML packet) embedded within the document displayed in the GdViewer control. These tags, also known as document's metadata, allows for additional information to be stored within a document.
Syntax
'Declaration
 
Public Function TagCount() As Integer
public int TagCount()
public function TagCount(): Integer; 
public function TagCount() : int;
public: int TagCount(); 
public:
int TagCount(); 

Return Value

The total number of tags embedded within the displayed document. Please always use the GetStat method to determine if this method has been successful.
Remarks
We strongly recommend using the GetStat method to identify the specific reason for the method's failure.

Please note that this method handles EXIF tags, IPTC tags, Extra tags (like Adobe Image Information tags etc.), Thumbnail related tags, GPS tags and XML packet metadata.

Example
How to find out the total number of tags embedded in the displayed document.
'We assume that the GdViewer1 control has been properly integrated
'and your document has been properly displayed as well.
Dim count As Integer = GdViewer1.TagCount()
If GdViewer1.GetStat() = GdPictureStatus.OK Then
    Dim message As String = "Tags count: " + count + vbCrLf
    Dim tagID As Tags = Tags.TagUnknown
    Dim tagName As String = "", tagValue As String = ""
    For i As Integer = 1 To count
        tagID = GdViewer1.TagGetID(i)
        If GdViewer1.GetStat() = GdPictureStatus.OK Then tagName = GdViewer1.TagGetName(i)
        If GdViewer1.GetStat() = GdPictureStatus.OK Then tagValue = GdViewer1.TagGetValueString(i)
 
        If GdViewer1.GetStat() = GdPictureStatus.OK Then
            message = message + vbCrLf + tagName + " (" + tagID + "): " + tagValue
        Else
            message = message + vbCrLf + "Tag nr." + i + "  Status: " + GdViewer1.GetStat().ToString()
        End If
    Next
    MessageBox.Show(message, "GdViewer.TagCount")
Else
    MessageBox.Show("The number of tags can't be found. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.TagCount")
End If
//We assume that the GdViewer1 control has been properly integrated.
//and your document has been properly displayed as well.
int count = GdViewer1.TagCount();
if (GdViewer1.GetStat() == GdPictureStatus.OK)
{
    string message = "Tags count: " + count + "\n";
    Tags tagID = Tags.TagUnknown;
    string tagName = "", tagValue = "";
    for (int i = 1; i <= count; i++)
    {
        tagID = GdViewer1.TagGetID(i);
        if (GdViewer1.GetStat() == GdPictureStatus.OK)
            tagName = GdViewer1.TagGetName(i);
        if (GdViewer1.GetStat() == GdPictureStatus.OK)
            tagValue = GdViewer1.TagGetValueString(i);
        if (GdViewer1.GetStat() == GdPictureStatus.OK)
            message = message + "\n" + tagName + " (" + tagID + "): " + tagValue;
        else
            message = message + "\nTag nr." + i + "  Status: " + GdViewer1.GetStat().ToString();
    }
    MessageBox.Show(message, "GdViewer.TagCount");
}
else
    MessageBox.Show("The number of tags can't be found. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.TagCount");
See Also

Reference

GdViewer Class
GdViewer Members
TagGetID Method
TagGetName Method
TagGetValueString Method
IPTCCount Method