Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi there

 

I have a VB app that the user enters in data into a textbox then prints it out on a form. The textbox is a multiline now when it is printed onto the form it runs off the edge and doesnt start a new line.

Basically i need to split the text into 60 characters and put them in a array then run through the array and print the text.....hope it sounds ok......

 

I am abit lost here dont really know where to start.

Any help to get me started will be appreciated

Posted

Try this:

 

       Dim s As String = TextBox1.Text
       Dim ctr As Integer = Math.Floor(s.Length / 60)
       Dim lines(ctr) As String
       Dim k As Integer
       For k = 0 To ctr
           If k = ctr Then
               lines(k) = s.Substring(k * 60)
           Else
               lines(k) = s.Substring(k * 60, 60)
           End If
       Next

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...