Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Carriage return on string ? 12 Feb 2018 14:10 #3906

  • DexterZ
  • DexterZ's Avatar
  • Topic Author


  • Posts: 28
  • Hello Guys!

    First time I've tried X# and it's like wrting CLIPPER inside Visual Studio YAY! here's my code ^ _^ Y but as you may notice string "r\n" escape key is not working.


    PRIVATE METHOD button1_Click(sender AS OBJECT, e AS System.EventArgs) AS VOID
        
         *-> Memvars
         *
         LOCAL _CUSTOMER AS MDBf.Table
         *
         LOCAL mCustNo   AS STRING
         LOCAL mCustName AS STRING            
                 
         *-> Open customer table
         *
         _CUSTOMER := Table{}              
         _CUSTOMER.File.Open("C:\TMP\CUSTOMER.DBF",TableShare.Shared,TableAccess.ReadWrite)
                 
         *--> Display all customer no. and name
         *
         DO WHILE ! _CUSTOMER.Navigator.IsEOF() 
            *
            mCustNo   := _CUSTOMER.Record.C("CUST_NO")
            mCustName := _CUSTOMER.Record.C("CUST_NAME")
            *
            MessageBox.Show("Customer No: "+mCustNo+"\r\n"+"Customer Name: "+ mCustName)
            *
            _CUSTOMER.Navigator.Skip()
            *    
         ENDDO
                
         *-> Close table
         *
         _CUSTOMER.File.Close() 
         _CUSTOMER.Dispose()            
        
     END CLASS



    The display will be :

    Customer No: C0008 \r\nCustomer Name: ALMOND MARIA
    No other languages can run like a Fox! long live xBase!
    Dexter Zamora, Manila
    ManagedDbf.Blogspot.com/

    Please Log in or Create an account to join the conversation.

    Last edit: by DexterZ.

    Carriage return on string ? 12 Feb 2018 14:24 #3908

    • Chris
    • Chris's Avatar


  • Posts: 3667
  • Hello Dexter,

    Very glad you enjoyed X#, we are actually extremely proud of that, of bringing Clipper and descendants into the .Net world!

    About your escaped string, by default strings are "regular" in X#, escaped strings must be denoted with an "e" in front of them: e"\r\n". Or you can simply used "CRLF" instead of that, as in string1 + CRLF + string2. (you will find CRLF defined in \XSharp\Include\XSharpDefs.xh)

    Please see also docs.xsharp.it/doku.php?id=strings

    Chris
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    Carriage return on string ? 12 Feb 2018 14:36 #3909

    • DexterZ
    • DexterZ's Avatar
    • Topic Author


  • Posts: 28
  • Hi Sir Chris,

    Thanks for fast reply, CRLF and CHR(13) works like a charm, I didn't expect CHR(13) will work, it's just an instinct coming from Visual FoxPro ^_^Y but it does ;)

    Thank you Sir!
    No other languages can run like a Fox! long live xBase!
    Dexter Zamora, Manila
    ManagedDbf.Blogspot.com/

    Please Log in or Create an account to join the conversation.

    Carriage return on string ? 12 Feb 2018 15:03 #3911

    • Chris
    • Chris's Avatar


  • Posts: 3667
  • You're very welcome! :)
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    Carriage return on string ? 13 Feb 2018 00:35 #3941

    • NickFriend
    • NickFriend's Avatar


  • Posts: 237
  • PMFJI, but why not start to take advantage of the .Net classes... Environment.NewLine.

    Nick

    Please Log in or Create an account to join the conversation.

    Carriage return on string ? 13 Feb 2018 01:58 #3942

    • DexterZ
    • DexterZ's Avatar
    • Topic Author


  • Posts: 28
  • Yes sir NewLine is cool specially on non windows platform ^_^y Thanks for the info
    No other languages can run like a Fox! long live xBase!
    Dexter Zamora, Manila
    ManagedDbf.Blogspot.com/

    Please Log in or Create an account to join the conversation.

    Carriage return on string ? 13 Feb 2018 09:31 #3947

    • FFF
    • FFF's Avatar


  • Posts: 1378
  • Nick,
    i'd expect CRLF to be expanded under the hood to Environment.NewLine...
    Seems sensible, opposed to CHR(10) etc. which clearly states, what the coder wants.

    Karl
    Regards
    Karl (X# 2.13.0.6; Xide 1.32; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    Carriage return on string ? 13 Feb 2018 14:38 #3962

    • Chris
    • Chris's Avatar


  • Posts: 3667
  • Hi Karl,

    Compatibility...:)

    Chris
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    Carriage return on string ? 13 Feb 2018 14:57 #3964

    • NickFriend
    • NickFriend's Avatar


  • Posts: 237
  • Ah, but he's having to change his code anyway, so this is when you can start chipping away at replacing old style coding...

    Nick

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1