Skip to content

Taxes

A collection of Tax objects generated from the tax table.

Syntax

value = object.Taxes

object is a TaxControl instance.

value is a Tax array variable.

Details

The Taxes object represents a collection of Tax objects. This collection has the following properties:

NameDescription
CountNumber of Tax objects in the collection
Item(x)Method for accessing a tax object by name or position. If x is a number (.NET only), get the xth object. If x is a string, get the tax item with the name matching the string. Matches are case-insensitive.

Examples

Using these properties, it is possible to enumerate all Tax objects in the tax table file.

Using Taxes.Item numerically:

// using TaxControls;
try {
CTaxControl tc = new CTaxControl();
tc.DataFilename = "us.dat";
for (int i=0; i<tc.Taxes.Count; i++) {
Tax t = tc.Taxes.Item(i);
Console.WriteLine(t.Name);
}
} catch (TaxControlException e) {
Console.WriteLine(e.Message);
}

Using Taxes.Item with the tax name:

// using TaxControls;
try {
CTaxControl tc = new CTaxControl();
tc.DataFilename = "us.dat";
Tax t = tc.Taxes.Item("Federal Income Tax");
Console.WriteLine(t.Instructions);
} catch (TaxControlException e) {
Console.WriteLine(e.Message);
}

Using enumeration of the collection:

// using TaxControls;
try {
CTaxControl tc = new CTaxControl();
tc.DataFilename = "us.dat";
foreach (Tax t in tc.Taxes) {
Console.WriteLine(t.Name);
}
} catch (TaxControlException e) {
Console.WriteLine(e.Message);
}