Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Referencing sequential field names with a FOR loop

Status
Not open for further replies.

rthunter

IS-IT--Management
Jul 16, 2002
8
US
I created a window (not a Data Window) in PB10, and on it are 20 edit mask objects, named em_value1 through em_value20. Upon the user clicking a Submit button (on the same window) I would like to step through each edit mask object to validate the data that the user input.

Is there a way to refer to each field by using a variable that increments its value 1 through 20? I'd prefer not to have to use 20 separate IF statement blocks.

Below is an example of what I would like to accomplish. I know its syntax is completely invalid, but maybe it will illustrate what I want to do.

INT l_fieldno

FOR l_fieldno = 1 TO 19
IF em_value{l_fieldno} > em_value{l_fieldno + 1} THEN
MessageBox('Error','Input value for row ' + STRING(l_fieldno + 1) + ' must be greater than the preceeding value.', StopSign!)
NEXT

Thanks for any assistance you can offer!
 
Hi,

Check this


Long ll_Component

editmask lem

For ll_Component = 1 To UpperBound(control)
if control[ll_Component].TypeOf() = EditMask! then
lem = control[ll_Component]
Messagebox("", lem.text)
end if
Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top