Version

ForwardHistoryCount Property

Gets the number of items in the ForwardHistory.
Syntax
'Declaration
 
Public ReadOnly Property ForwardHistoryCount As Integer
public int ForwardHistoryCount {get;}
Example
The following code snippet demonstrates how to iterate through the BackHistory and Forward history in order to save this information to an XML file.
Note that the Tag property is not serialized here because it is of type object, so individual serialization mechanisms should be used based on the data type in your application.

Imports System.Xml
Imports Infragistics.Win.UltraWinToolbars

Private Sub btnSaveHistory_Click(ByVal sender As Object, ByVal e As EventArgs)
	Dim writer As XmlTextWriter = Nothing

	Try
		writer = New XmlTextWriter("History.xml", Nothing)
		writer.Formatting = Formatting.Indented
		writer.Namespaces = False
		writer.WriteStartDocument()
		writer.WriteStartElement("History")

		' Serialize the back history
		If Me.UltraToolbarsManager1.NavigationToolbar.BackHistoryCount > 0 Then
			writer.WriteStartElement("BackHistory")
			Dim backHistoryItem As NavigationHistoryItem
			For Each backHistoryItem In Me.UltraToolbarsManager1.NavigationToolbar.BackHistory
				writer.WriteStartElement("Item")
				writer.WriteString(backHistoryItem.Text)
				writer.WriteEndElement()
			Next
			writer.WriteEndElement()
		End If

		' Serialize the current item
		Dim currentItem As NavigationHistoryItem = Me.UltraToolbarsManager1.NavigationToolbar.CurrentItem
		If Not currentItem Is Nothing Then
			writer.WriteStartElement("CurrentItem")
			writer.WriteString(currentItem.Text)
			writer.WriteEndElement()
		End If

		' Serialize the forward history
		If Me.UltraToolbarsManager1.NavigationToolbar.ForwardHistoryCount > 0 Then
			writer.WriteStartElement("ForwardHistory")
			Dim forwardHistoryItem As NavigationHistoryItem
			For Each forwardHistoryItem In Me.UltraToolbarsManager1.NavigationToolbar.ForwardHistory
				writer.WriteStartElement("Item")
				writer.WriteString(forwardHistoryItem.Text)
				writer.WriteEndElement()
			Next
			writer.WriteEndElement()
		End If

		writer.WriteEndElement()
		writer.WriteEndDocument()
		writer.Flush()
	Catch ex As Exception
		MessageBox.Show("Could not serialize history\n\n" + ex.Message)
	Finally
		If Not writer Is Nothing Then
			writer.Close()
		End If
	End Try
End Sub
using System.Xml;
using Infragistics.Win.UltraWinToolbars;

private void btnSaveHistory_Click(object sender, EventArgs e)
{
    XmlTextWriter writer = null;
    try
    {
        writer = new XmlTextWriter("History.xml", null);
        writer.Formatting = Formatting.Indented;
        writer.Namespaces = false;
        writer.WriteStartDocument();
        writer.WriteStartElement("History");

        // Serialize the back history
        if (this.ultraToolbarsManager1.NavigationToolbar.BackHistoryCount > 0)
        {
            writer.WriteStartElement("BackHistory");
            foreach (NavigationHistoryItem backHistoryItem in this.ultraToolbarsManager1.NavigationToolbar.BackHistory)
            {
                writer.WriteStartElement("Item");                        
                writer.WriteString(backHistoryItem.Text);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
        }

        // Serialize the current item
        NavigationHistoryItem currentItem = this.ultraToolbarsManager1.NavigationToolbar.CurrentItem;
        if (currentItem != null)
        {
            writer.WriteStartElement("CurrentItem");
            writer.WriteString(currentItem.Text);
            writer.WriteEndElement();
        }

        // Serialize the forward history
        if (this.ultraToolbarsManager1.NavigationToolbar.ForwardHistoryCount > 0)
        {
            writer.WriteStartElement("ForwardHistory");
            foreach (NavigationHistoryItem forwardHistoryItem in this.ultraToolbarsManager1.NavigationToolbar.ForwardHistory)
            {
                writer.WriteStartElement("Item");
                writer.WriteString(forwardHistoryItem.Text);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
        }

        writer.WriteEndElement();
        writer.WriteEndDocument();
        writer.Flush();
    }
    catch (Exception ex)
    {
        MessageBox.Show("Could not serialize history\n\n" + ex.Message);
    }
    finally
    {
        if (writer != null)
            writer.Close();
    }
}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also