Welcome to the XSharp News Server and Forum

You are welcome to participate in the XSharp newsgroups and forum.

The XSharp News Server can be found at news.xsharp.info, port 119 (nntp). You can login with the user name XSharpUser and password X#Rulez!.
You can also post through the web interface. In that case you need to create a user account first.
The newsgroups and web interface are not synchronized yet. We are working on that.

When posting to the newsgroups and forums we ask you kindly to follow the rules that you can find here: https://www.xsharp.info/faq/39-xsharp-news-server-rules

Carriage return on string ?

More
1 week 4 days ago - 1 week 4 days ago #1 by Dexter Z
Dexter Z created the topic: Carriage return on string ?
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
Last Edit: 1 week 4 days ago by Dexter Z.

Please Log in to join the conversation.

More
1 week 4 days ago #2 by Chris Pyrgas
Chris Pyrgas replied the topic: Carriage return on string ?
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 to join the conversation.

More
1 week 4 days ago #3 by Dexter Z
Dexter Z replied the topic: Carriage return on string ?
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!

Please Log in to join the conversation.

More
1 week 4 days ago #4 by Chris Pyrgas
Chris Pyrgas replied the topic: Carriage return on string ?
You're very welcome! :)

XSharp Development Team
chris(at)xsharp.eu

Please Log in to join the conversation.

More
1 week 4 days ago #5 by Nick Friend
Nick Friend replied the topic: Carriage return on string ?
PMFJI, but why not start to take advantage of the .Net classes... Environment.NewLine.

Nick

Please Log in to join the conversation.