Option Strict Off Option Explicit On Imports VB = Microsoft.VisualBasic Friend Class frmDppConfigDisplay Inherits System.Windows.Forms.Form Public m_strMessage As String Public m_strTitle As String Public m_strDelimiter As String Private Sub cmdOK_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdOK.Click Me.Close() End Sub Private Sub frmDppConfigDisplay_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load txtCfg(0).BackColor = Me.BackColor txtCfg(1).BackColor = Me.BackColor If (Len(Trim(m_strTitle)) > 0) Then Me.Text = m_strTitle End If If (Len(Trim(m_strDelimiter)) = 0) Then m_strDelimiter = vbNewLine SetMessage(m_strMessage, m_strDelimiter) End Sub Private Sub SetMessage(ByRef cstrMsg As String, ByRef cstrDelimiter As String) Dim iHalf As Integer Dim iDelimiter As Integer ' \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 = CInt(Len(cstrMsg) / 2) iDelimiter = InStr(iHalf, cstrMsg, cstrDelimiter) If (iDelimiter >= iHalf) Then ' try to find next \r\n txtCfg(0).Text = VB.Left(cstrMsg, iDelimiter + cstrDelimiter.Length() - 1) txtCfg(1).Text = Mid(cstrMsg, iDelimiter + cstrDelimiter.Length()) End If End If End Sub End Class