CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Apr 2014
    Posts
    2

    Exclamation Rq assistance with Wrap Text + max length (VB6)

    Hi,

    I'm stuck with a project for work.
    My objectives are that i have a text box where an agent can write her story.
    And this text need to be adjusted.

    1. max length per line must be 59 symbols.(bytes)
    2. If max length is achieved the line must be shortened, it must never be longer then 59(+4 see next point)
    3. In front of the line it must add "RMN/"
    4. After each line it must add ";"
    4. No empty lines allowed in the text
    5. No ";" allowed in the text

    *Note*
    I would like it to start with adding all lines behind each other. and then start cutting it in pieces.
    This way I want to avoid lines with 1 or 2 word. As each of them cost us money.
    So i think, first add them all behind each other (mind the space behind the full stop.) and then cutting them in 59, and then adding "RMN/" in front of all them. (and if possible ";" behind them.)


    So if an agent added the text in a text box.

    "Hoi collega’s,

    Wij, hier bij de inplant Capgemini, zijn op het moment slecht bereikbaar omdat sinds gisteravond/vannacht een nieuwe telefooncentrale
    In gebruik is genomen.
    Het zou dus heel goed mogelijk zijn dat passagiers jullie zullen gaan bellen. De travelmanager is ook over de storing ingelicht.

    Sorry voor het ongemak.

    Gr.
    Roland
    "

    It should be converted to :

    RMN/Hoi collega’s, wij, hier bij de inplant XXXXXXXXX, zijn;
    RMN/op het moment slecht bereikbaar omdat sinds;
    RMN/gisteravond/vannacht een nieuwe telefooncentrale In;
    RMN/gebruik is genomen. Het zou dus heel goed mogelijk zijn;
    RMN/dat passagiers jullie zullen gaan bellen. De;
    RMN/travelmanager is ook over de storing ingelicht. Sorry;
    RMN/voor het ongemak. Gr. Xxxxxxx;

    After parsing this, I will use this text to send it into another environment.

    I really hope that you/anyone can help me with this.
    As i'm really stuck at the moment.

    Please feel free to ask if you need more info.

    Kind regards,
    Damien

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Rq assistance with Wrap Text + max length (VB6)

    Well you could use the Split() function to split the text up based on the locations of the space character. This would give you an array of words. You may want to run a Replace() function on it first to remove any ; that may appear in the text.
    Once you have the array you can loop through the array checking the length of the current line and length of the next word to determine if the word should be added to the current line or a new line should be started.
    Shouldn't be to hard. Have a go at it and post back if you run into difficulties.
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Apr 2014
    Posts
    2

    Re: Rq assistance with Wrap Text + max length (VB6)

    Thank you for your suggestions, i will try them out, but i'm only a basic beginner.
    I manage by google and adjust the things that i need.

    Starting from scrats is so complicated.


    If anyone else can help me out with a start, that would be much appreciated.

    regards,

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured