New topic: 

Help Please. OutOfBounds Error

<http://forums.realsoftware.com/viewtopic.php?t=43871>

  Page 1 of 1
 [ 2 posts ]  Previous topic | Next topic AuthorMessageDeathstrike1313 Post 
subject: Help Please. OutOfBounds ErrorPosted: Thu May 03, 2012 10:57 pm 
Joined: Thu May 03, 2012 10:51 pm
Posts: 1 Hello. I recently got the trial of real software and i tried out a few 
tutorials. i was testing out my finished URL Manager from the tutorial and when 
my URL list box is empty, and i hit delete, the application will crash because 
of an unhandled OutOfBoundsException.

It states "An exception of class OutOfBoundsException was not handled. The 
application must shut down.

Is there any way i can stop this and make a pop-up window stating "There are no 
URL's to delete"?

Im new to coding and real software.
Top  amitavak Post subject: Re: Help Please. OutOfBounds ErrorPosted: Fri May 
04, 2012 1:07 am 
Joined: Mon Jan 02, 2012 1:51 am
Posts: 192 Yes,

Before writting the code to delete from listBox, first check if there is any 
entry in the listBox. Like

if ListBox1.ListCount > 0 Then
  
  //Your delete code goes here
  
Else
  MsgBox  "There are no URL's to delete"
  
End if


You can also disable the delete button first and enable it only when there is 
any row selected. In ListBox change event, you can write

if me.SelCount >= 1 Then
  //Enable the button
Else
  //Disable the button
End If


you can always handle the exception by using a "Try...catch" block or 
"Exception" block.
_________________
Amitava
Real Studio 2011 Release 4
Windows 7 (32 bit)
Top  Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 
months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1
 [ 2 posts ] 
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to