This is the code in the button/Action:
Dim i as integer
Dim s as string
Dim D as AddressBookData
ListBox1.DeleteAllRows
AddressBook
For i=0 to N-1
s=Contacts(i).FirstName + " " + Contacts(i).LastName
ListBox1.AddRow s
ListBox1.refresh
s=Contacts(i).EmailAddresses
ListBox1.Cell(ListBox1.LastIndex,1)=s
ListBox1.refresh
s=Contacts(i).PhoneNumbers
ListBox1.Cell(ListBox1.LastIndex,2) = s
ListBox1.refresh
next
Exception err
If err isA OutofBoundsException then
MsgBox "No data available."
End if
AddressBook (Method) has the following:
book=System.AddressBook
Contacts()=book.Contacts()
N=Ubound(Contacts())
The debugger is showing the error in the line:
s=Contacts(i).PhoneNumbers
because there is no data found. I do not see the MsgBox message. Is
this because the code is in the button/action, not a method?
Paul
On Feb 25, 2005, at 10:09 AM, Joseph J. Strout wrote:
At 9:47 AM -0500 2/25/05, Paul Young wrote:
I'm writing a simple utility to fill a ListBox with data from an
AddressBook: Name, email address and telephone number. Some contacts
do not include the telephone number data and I get an
"OutOfBoundsException" error even though I use the following code at
the end of the Method:
Are you sure that this method is where the unhandled exception is
being raised? When you run it under the debugger, where does it stop
to show you the error? (And remember, the debugger WILL stop even
when you have an exception handler; it's just that you should be able
to continue, dropping down into the Exception or Catch block).
Best,
- Joe
--
REAL World 2005 - The REALbasic User Conference
March 23-25, 2005, Austin, Texas
<http://www.realsoftware.com/realworld>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>
|