On Sep 8, 2006, at 4:53 AM, Steven Hedgepeth wrote:


Apparently Ubound does not work for control arrays or else I've been unable to get the syntax correct. Does RB have a function or property that counts the number of controls in a control array? Sincerely,Steven Hedgepeth


You can create your own. Keep the following method in a module, passing in a reference to the window and the name of the control 'array' as a string:

Function ControlArrayCount(w as Window, ControlName as string) As Integer
  dim i, Count as integer

  For i = 0 to w.ControlCount - 1  // all controls
    If w.Control(i).Name = ControlName then
      Count = Count + 1
    End
  Next
  Return Count
End Function

Then when you need a count, call it as in this example based on a call from a pushbutton on the containing window:

dim NumberControls as integer = ControlArrayCount(self, "MyEditField")

In the calling example above, the control 'array' consists of MyEditField(0), MyEditField(1),...


Best,


Jack



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to