Announcement

Collapse
No announcement yet.

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.
    BrettNinjaTrader Product Management

    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.
        BrettNinjaTrader Product Management

        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.
            BrettNinjaTrader Product Management

            Comment


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

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              607 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              353 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              105 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              560 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              561 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X