Public Sub Addpayee2()
Try
Dim payee2 As String = ""
payee2 = cboAccounts.Text.ToString()
Dim g As Graphics = cboAccounts.CreateGraphics
Dim pword As String, poneLine As String
Dim ptest As String = "", ptest1 As String = ""
Dim pwords() As String
If g.MeasureString(payee2, cboAccounts.Font).Width >= cboAccounts.Width Then
poneLine = payee2
pwords = poneLine.Split(" ")
For Each pword In pwords
ptest = ptest & pword
If g.MeasureString(ptest, cboAccounts.Font).Width >= cboAccounts.Width Then
txtPayAgainst.Text = ptest1
GoTo l1
Else
ptest = ptest & " "
ptest1 = ptest
End If
Next
l1: txtPayAgainst.Text = ptest1
txtpayee2.Visible = True
txtpayee2.Text = payee2.Substring(ptest1.Length)
' txtPayAgainst.Text = payee2.Substring(0, 10)
' txtpayee2.Text = payee2.Substring(10)
' 'txtpayee2.Visible = True
Else
txtPayAgainst.Text = payee2
txtpayee2.Text = ""
txtpayee2.Visible = False
End If
Catch ex As Exception
MsgBox(ex.Message, , "Cheque Print")
End Try
End Sub