sx_GetTrimString

<< Click to Display Table of Contents >>

Navigation:  Apollo API Listing >

sx_GetTrimString

VB Declaration

Declare Function sx_GetTrimString Lib "Apollo9.dll"

(ByVal cpFieldName As String)

As String

Description

Extracts the contents of any field as a string and trim trailing spaces.

C Declaration

LONG FAR PASCAL sx_GetTrimString

(BYTEP cpFieldName);

Parameters

cpFieldName: The name of the field.

Return Value

The field contents are returned as a string with trailing spaces removed.

 

This is the function to use when loading an edit control (i.e., DBEdit box). Trailing spaces are invisible to the user and an edit control that has a defined data entry length becomes difficult to edit when it is full of white space to the right of the data.

VB Example

Sub Brw1_Change (nRowCol As Integer)

' whenever rec no changes, dynamically

' display memo and other detail data  

If nRowCol <> BRW_CHANGE_COL Then

If sx_Empty("notes") Then

tMemo.Text = ""

Else

tMemo.Text = sx_GetMemo("notes", 0)

End If

tLast.Text = sx_GetTrimString("last")

tCity.Text = sx_GetTrimString("city")

tCountry.Text = sx_GetTrimString("country")

tPhone.Text = sx_GetTrimString("ph_voice")

End If

End Sub

C Example

// check if name should be in red

lstrcpy((LPSTR) caRecord, (LPSTR) sx_GetTrimString((BYTEP) "business"));

if (lstrcmpi((LPSTR) caRecord, (LPSTR) "PLUMBER") == 0)

cColor = 13; // red

else

cColor = 1; // black

See Also

sx_GetString