Option Explicit
Public m_strMessage As String
Public m_strTitle As String
Public m_strDelimiter As String
Private Sub cmdOK_Click()
Unload Me
End Sub
Private Sub Form_Load()
txtCfg(0).BackColor = Me.BackColor
txtCfg(1).BackColor = Me.BackColor
If (Len(Trim(m_strTitle)) > 0) Then
Me.Caption = m_strTitle
End If
If (Len(Trim(m_strDelimiter)) = 0) Then m_strDelimiter = vbNewLine
SetMessage m_strMessage, m_strDelimiter
End Sub
Private Sub SetMessage(cstrMsg As String, cstrDelimiter As String)
Dim iHalf As Long
Dim iDelimiter As Long ' \r\n ms win
If (Len(cstrMsg) = 0) Then Exit Sub
If (Len(cstrMsg) < 100) Then
txtCfg(0).Text = cstrMsg
txtCfg(1).Text = ""
Else
iHalf = CLng(Len(cstrMsg) / 2)
iDelimiter = InStr(iHalf, cstrMsg, cstrDelimiter)
If (iDelimiter >= iHalf) Then ' try to find next \r\n
txtCfg(0).Text = Left(cstrMsg, iDelimiter + 1)
txtCfg(1).Text = Mid(cstrMsg, iDelimiter + 3)
End If
End If
End Sub