Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.IbmHosts Library / Attachmate.Reflection.Objects.Emulation.IbmHosts Library / IbmScreen Object / FindField4 Method
Start row position.
Start column position.
Length of the field.
The type of field.This is a FieldType Enumeration value that specifies the type of field (protected, unprotected, or any) to search for.
A FindOption enumeration value that specifies the direction to search.
Example
FindField4 Method
Locates a field that matches the specified field length and field attributes, starting from the specified row and column.
Syntax
expression.FindField4( _
   ByVal startRow As Integer, _
   ByVal startColumn As Integer, _
   ByVal fieldLength As Integer, _
   ByVal fieldtype As FieldType, _
   ByVal findoption As FindOption _
) As HostField object 
where expression is a variable that represents a IbmScreen Object

Parameters

startRow
Start row position.
startColumn
Start column position.
fieldLength
Length of the field.
fieldtype
The type of field.This is a FieldType Enumeration value that specifies the type of field (protected, unprotected, or any) to search for.
findoption
A FindOption enumeration value that specifies the direction to search.

Return Value

If a field is found, a HostField object is returned. If no field is found, nothing is returned.
Exceptions
ExceptionDescription
This exception is thrown if the startRow or startColumn parameters are outside the range of valid values: (1 to Rows) or (1 to Columns).
Remarks
A search can go up or down the host screen. The method returns the host field if it finds one or Nothing if not.
Example
When the mouse is clicked on a screen, this sample finds the next unprotected field that is 8 characters long and moves the cursor to the start of that field.

To run this sample, open any IBM3270 session and copy the code into the ThisIbmScreen code window. On the VBA editor View menu, choose Immediate window. Then click on various screen locations. If your screen doesn't doesn't have a field that is 8 characters long, change the field lengths in the code to match a field length on the screen.

Private Sub IbmScreen_MouseClickEx(ByVal windowMessage As Long, ByVal row As Long, ByVal column As Long, ByVal x As Long, ByVal y As Long)
 
    Dim field As HostField
    Dim rtrnCode As ReturnCode
    
    'Print the row and column the mouse was clicked on
    Debug.Print "row = " & row & " and column = " & column
    
    Set field = ThisIbmScreen.FindField4(row, column, 8, FieldType_Unprotected, FindOption_Forward)
    
    'Print the starting row and column of the next unprotected field that is 8 characters long
    Debug.Print "Row of next field = " & field.StartRow & " Column of next field = " & field.StartColumn
    
    ThisIbmScreen.Wait (2000)
    
    'Go to the next unprotected field
    rtrnCode = ThisIbmScreen.MoveCursorTo1(field.StartRow, field.StartColumn)
       
    MouseClickEx = True
    
End Sub
See Also