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

Threaded View

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

    Re: Replace Carrage control in text in VB5

    VbCrVbCr is not valid Vb would think you are using a variable that you have not defined and you would actually be passing an empty string so nothing would happen. This assumes that you are not using Option Explicit which btw should always be used. If you were using Option Explicit then the IDE would have given you are error message and flagged the VbCrVbCr as an undefined variable.

    To serach for double CRs it would be VbCr & VbCr or it could also be Chr(13) & Chr(13)

    Not sure why it might drop a character, would have to step through the code to see.
    That function is very old and was used only in a few cases mostly to remove embedded quotes from data in preparing SQL statements.

    If it is dropping a character it would be from this line
    Rtemp = Right$(Source, Len(Source) - (Startpos + Len(Target)))
    but if it were going to happen it should happen all the time.

    Upgrading to .Net is a good idea but for existing projects you really should do a total re-write if you want to use them in .Net

    If you have access to VB6 I would strongly urge you to use that for existing VB5 projects as it will work very well on VB5 projects and gives you more features including a build in replace function.


    sometext<p>sometext</p>sometext
    In any case you will not get the result above using a replace function as there is no way to determine which place to put what. If your intention is to create a line break you could use <br> or <br/> which should work fine. Using <p> it should be <p>some text</p><p>some text </p>
    Last edited by DataMiser; February 16th, 2012 at 01:57 PM.
    Always use [code][/code] tags when posting code.

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