Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Problems Reading from file

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

    Problems Reading from file

    I'm using your example about "Read and Write in a text file" (SampleFileReadWrite) but I have a error message with the line: "foreach (string s in split)".

    The message is: "The name split doesn't exist in the actual context".

    How can I solve this error?

    Thanks in advance.

    Jesus.

    #2
    Hello,

    Thanks for your forum post.

    What line of code does it point to, can you please post the code so that I may further assist.

    I look forward to assisting you further.

    Comment


      #3
      Ok, I have attached the file (Escritor.cs).

      Thanks.


      Originally posted by NinjaTrader_Brett View Post
      Hello,

      Thanks for your forum post.

      What line of code does it point to, can you please post the code so that I may further assist.

      I look forward to assisting you further.
      Attached Files

      Comment


        #4
        Hello,

        You need to declare the string in the variables section at the top.

        As currently your declaring it in a if statement that if it doesnt run Misplit would not exist if the If Branch does not run. Therefor you get the compiler error.

        Let me know if I can be of further assistance.

        Comment


          #5
          Sorry, but when I declare this variable with line int the : publicstring Misplit = ""; in the Region Variables, I'm getting the error too.

          How and where must I declare this variable?

          Comment


            #6
            Here are the 2 line changes I made:

            privatestring [] Misplit;

            Misplit = readText.Split(new Char [] {' ', '\r', '\n'});


            Let me know if I can be of further assistance.

            Comment


              #7
              Great! Thank you very much for your help.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by helpwanted, Today, 03:06 AM
              1 response
              10 views
              0 likes
              Last Post sarafuenonly123  
              Started by Brevo, Today, 01:45 AM
              0 responses
              9 views
              0 likes
              Last Post Brevo
              by Brevo
               
              Started by aussugardefender, Today, 01:07 AM
              0 responses
              5 views
              0 likes
              Last Post aussugardefender  
              Started by pvincent, 06-23-2022, 12:53 PM
              14 responses
              242 views
              0 likes
              Last Post Nyman
              by Nyman
               
              Started by TraderG23, 12-08-2023, 07:56 AM
              9 responses
              387 views
              1 like
              Last Post Gavini
              by Gavini
               
              Working...
              X