Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.IbmHosts Library / Attachmate.Reflection.Objects.Emulation.IbmHosts Library / IbmScreen Object / GetField Method
Host field row position.
Host field column position.
Example
GetField Method
Gets the host field that the specified row and column are part of.
Syntax
expression.GetField( _
   ByVal row As Integer, _
   ByVal column As Integer _
) As HostField object 
where expression is a variable that represents a IbmScreen Object

Parameters

row
Host field row position.
column
Host field column position.

Return Value

Exceptions
ExceptionDescription
This exception is thrown if the row or column parameters are outside the range of valid values: (1 to Rows) or (1 to Columns).
Example
This sample displays the starting row and column and length when the mouse is clicked on a field. It also displays whether the field is protected or unprotected. To run this sample, open an IBM3270 session and paste code into the ThisIbmScreen code window. Then click the mouse on a screen with some unprotected fields.
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
    Set field = ThisIbmScreen.GetField(row, column)
    
    If field.IsProtectedField Then
    
        text = "This protected field starts on row " & field.StartRow & " and Column " & field.StartColumn & " and is " & field.length & " characters long."
    Else
        text = "This unprotected field starts on row " & field.StartRow & " and Column " & field.StartColumn & " and is " & field.length & " characters long."
    End If
    
    MsgBox text
    
End Sub
This example prints the text in a field when the mouse is clicked in the field.
Private Sub IbmScreen_MouseClickEx(ByVal windowMessage As Long, ByVal row As Long, ByVal column As Long, ByVal x As Long, ByVal y As Long)
 
    'When the the left mouse button is released (windowMessage = 514 is WM_LBUTTONUP), get the field the mouse is in and print the text in the field.
    If windowMessage = 514 Then
        Sleep 200
      
        Dim myField As HostField
        Dim myFieldText As String
 
        'Get the field
        Set myField = ThisIbmScreen.GetField(row, column)
 
        'Print the text in field that was clicked
        myFieldText = myField.text
        Debug.Print myFieldText
    
    End If
    
End Sub
See Also