Announcement

Collapse
No announcement yet.

MID$ Problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MID$ Problem

    Hi to all

    Can someone confirm this test for me
    when run Pkt will not display anything (blank)
    but if I change the position to 1 instead of 2
    MID$(Pkt,1) = "Test" then it will Work.

    Its fine in PBCC501 but don't get the same result using
    PBWin9/8. I was trying to build up a String with various Characters
    in various positions, it would not display anything till the Position number
    was 1.


    Code:
    FUNCTION Test ()  AS LONG
        LOCAL Pkt        AS STRING * 10
     
        MID$(Pkt,2) = "Test"
        MSGBOX Pkt
     
    END FUNCTION
    Last edited by Peter Maroudas; 5 May 2009, 06:48 AM.
    Peter Maroudas

  • #2
    You have created a string where the first byte is a nul: CHR$(0). The MessageBox function in the Windows API stops displaying when it finds a nul. Consequently, it displays nothing.

    Best regards,

    Bob Zale

    Comment


    • #3
      Thank You Sir, it all makes sense now.
      Peter Maroudas

      Comment

      Working...
      X