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 funk10101, Today, 09:43 PM
              0 responses
              6 views
              0 likes
              Last Post funk10101  
              Started by pkefal, 04-11-2024, 07:39 AM
              11 responses
              37 views
              0 likes
              Last Post jeronymite  
              Started by bill2023, Yesterday, 08:51 AM
              8 responses
              44 views
              0 likes
              Last Post bill2023  
              Started by yertle, Today, 08:38 AM
              6 responses
              26 views
              0 likes
              Last Post ryjoga
              by ryjoga
               
              Started by algospoke, Yesterday, 06:40 PM
              2 responses
              24 views
              0 likes
              Last Post algospoke  
              Working...
              X