Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.IbmHosts Library / Attachmate.Reflection.Objects.Emulation.IbmHosts Library / IbmScreen Object / FindField1 Method
The screen row to start the search from
The screen column to start the search from
A FindOption enumeration value that specifies the direction to search.
Example
In This Topic
    FindField1 Method
    In This Topic
    Locates a field starting from the specified row and column.
    Syntax
    expression.FindField1( _
       ByVal startRow As Integer, _
       ByVal startColumn As Integer, _
       ByVal findoption As FindOption _
    ) As HostField object 
    where expression is a variable that represents a IbmScreen Object

    Parameters

    startRow
    The screen row to start the search from
    startColumn
    The screen column to start the search from
    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.
    Example
    This sample moves the cursor to the next field when the mouse is clicked on the screen. 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.
    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.FindField1(row, column, 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
    This example finds the first field on the screen and prints its row, column, length, and text.
    Sub FindAndPrintHostFieldValue()
     
        Dim hostfieldvar As HostField
        
        Set hostfieldvar = ThisIbmScreen.FindField1(1, 1, FindOption_Forward)
        
        Debug.Print hostfieldvar.toString
           
    End Sub
    See Also