Version

ParseString Method

Parses the string if possible and puts result in edit portion of the calculator If string cannot be parsed, does nothing
Syntax
'Declaration
 
Public Sub ParseString( _
   ByVal text As String _
) 
public void ParseString( 
   string text
)

Parameters

text
text string to be parsed
Example
This sample shows how you can use the parseString, and pushButton methods of the calculator to perform calculations.

Private Sub DoCalculation()

    ' Clear the calculator
    Me.UltraCalculator1.Clear()

    ' Push each button individually.
    ' The string passed in is the KEY of the button, not it's text.
    Me.UltraCalculator1.PushButton("2")
    Me.UltraCalculator1.PushButton("+")
    Me.UltraCalculator1.PushButton("3")
    Me.UltraCalculator1.PushButton("=")
    ' Result = 5

    ' Store displayed value in memory.
    Me.UltraCalculator1.MemoryStore()
    ' Memory Value is now 5

    ' Clear the calculator
    Me.UltraCalculator1.Clear()

    ' Parse string calculation
    Me.UltraCalculator1.ParseString("6+10=")
    ' Result = 16

    ' Add displayed value to current memory value.
    Me.UltraCalculator1.MemoryAdd()
    ' Memory Value is now 21

    Me.UltraCalculator1.Clear()
    Me.UltraCalculator1.MemoryRecall()
    ' Current value is now 21

    Me.UltraCalculator1.BackSpace()
    ' Current value is now 2

    Me.UltraCalculator1.PushButton("+")
    Me.UltraCalculator1.PushButton("3")
    Me.UltraCalculator1.PushButton("=")
    ' Current value is now 5

    ' Clear the memory
    Me.UltraCalculator1.MemoryClear()

End Sub
private void DoCalculation()
{

	// Clear the calculator
	this.ultraCalculator1.Clear();

	// Push each button individually.
	// The string passed in is the KEY of the button, not it's text.
	this.ultraCalculator1.PushButton("2");
	this.ultraCalculator1.PushButton("+");
	this.ultraCalculator1.PushButton("3");
	this.ultraCalculator1.PushButton("=");
	// Result = 5

	// Store displayed value in memory.
	this.ultraCalculator1.MemoryStore();
	// Memory Value is now 5

	// Clear the calculator
	this.ultraCalculator1.Clear();

	// Parse string calculation
	this.ultraCalculator1.ParseString("6+10=");
	// Result = 16

	// Add displayed value to current memory value.
	this.ultraCalculator1.MemoryAdd();
	// Memory Value is now 21

	this.ultraCalculator1.Clear();
	this.ultraCalculator1.MemoryRecall();
	// Current value is now 21
	
	this.ultraCalculator1.BackSpace();
	// Current value is now 2

	this.ultraCalculator1.PushButton("+");
	this.ultraCalculator1.PushButton("3");
	this.ultraCalculator1.PushButton("=");
	// Current value is now 5

	// Clear the memory
	this.ultraCalculator1.MemoryClear();

}
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