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 Hwop38, 05-04-2026, 07:02 PM
              0 responses
              168 views
              0 likes
              Last Post Hwop38
              by Hwop38
               
              Started by CaptainJack, 04-24-2026, 11:07 PM
              0 responses
              322 views
              0 likes
              Last Post CaptainJack  
              Started by Mindset, 04-21-2026, 06:46 AM
              0 responses
              246 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by M4ndoo, 04-20-2026, 05:21 PM
              0 responses
              350 views
              0 likes
              Last Post M4ndoo
              by M4ndoo
               
              Started by M4ndoo, 04-19-2026, 05:54 PM
              0 responses
              179 views
              0 likes
              Last Post M4ndoo
              by M4ndoo
               
              Working...
              X