How to iterate through account addresses for any entity that implements the ICustomerVendorAccount interface in Microsoft Office Small Business Accounting (885941)



The information in this article applies to:

  • Microsoft Office Small Business Accounting 2006
  • Microsoft Office Small Business Management Edition 2006
  • Microsoft Office Small Business Accounting 2006 Software Development Kit 1.2

INTRODUCTION

This article describes how to iterate through account addresses for any entity that implements the ICustomerVendorAccount interface in Microsoft Office Small Business Accounting.

MORE INFORMATION

You can access the account addresses by using the CustomerVendorAddresses property. The following code sample will display each address for a particular customer when you run the code in a command-line program.
Console.WriteLine("enter a customer account integer:");
int custInt = Convert.ToInt32(Console.ReadLine());
ICustomerAccount iCa = 
	(ICustomerAccount)iSbi.CustomerAccounts.GetByPrimaryKey(custInt);

Console.WriteLine("\ncustomer information:\n{0}\n{1}\n\naddress information:", iCa.AccountID, iCa.Name);

foreach (int i in Enum.GetValues(typeof(CustomerVendorAddressType)))
{
	if (iCa.CustomerVendorAddresses.DoesTypeExist(i))
	{
		ICustomerVendorAddress iCva = 
			iCa.CustomerVendorAddresses.GetByType((CustomerVendorAddressType) i);
		Console.WriteLine("\n{0}\n{1}, {2} {3}", 
			iCva.Address1, iCva.City, iCva.State, iCva.ZipCode);
	}
}
Note iSbi is a reference variable of ISmallBusinessInstance.

Modification Type:MinorLast Reviewed:4/4/2006
Keywords:kbMBSMigrate kbhowto KB885941 kbAudEndUser