Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Making a Path statement with a User Defined Input

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

    Making a Path statement with a User Defined Input

    I'm working with the StreamReader Sample and wanted to make the Path statement accept a user defined input.

    Thus in the SampleStreamReader example in the variables section is the declaration of the path:

    private string path = Cbi.Core.UserDataDir.ToString() + "MyTestFile.txt";

    I want to make "MyTestFile.txt" modifiable.

    I've been trying various things but nothing is working.

    Can someone help?

    Thank you
    taddypole...
    Last edited by Taddypole; 11-21-2012, 11:59 PM.

    #2
    Originally posted by Taddypole View Post
    I'm working with the StreamReader Sample and wanted to make the Path statement accept a user defined input.

    Thus in the SampleStreamReader example in the variables section is the declaration of the path:

    private string path = Cbi.Core.UserDataDir.ToString() + "MyTestFile.txt";

    I want to make "MyTestFile.txt" modifiable.

    I've been trying various things but nothing is working.

    Can someone help?

    Thank you
    taddypole...
    Code:
     
    private string fileName;
    private string path                 = Cbi.Core.UserDataDir.ToString()
    Code:
    path = path + this.FileName;
    Code:
     
    [Description("")]
    [GridCategory("Parameters")]
    public string FileName
    {
    get { return fileName; }
    set { fileName = value; }
    }

    Comment


      #3
      thank you koganam,

      I now have it working.
      Your help is much appreciated.

      ...taddypole

      Comment


        #4
        I now want to take this StreamReader to the next level by programmatically changing the file name based on today's date. The file I'm after is the log file created by NinjaTrader.

        I have most of the logic worked out but i'm having problems concatenating the path in this statement:

        if (File.Exists(path + fileName))


        It seems the above statement does not accept concatenation.

        Can someone shed some light on this one?

        thanks,
        taddypole...
        Attached Files
        Last edited by Taddypole; 11-30-2012, 02:17 PM.

        Comment


          #5
          never mind...

          if you try enough iterations, your bound to get it...

          here's the final solution...
          Attached Files

          Comment


            #6
            sorry, still have another bug, need to check for date change before updating the path. Otherwise is concatenates on each pass.

            out of time at the moment, will have to do this later...

            taddypole...

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CaptainJack, 05-29-2026, 05:09 AM
            0 responses
            227 views
            0 likes
            Last Post CaptainJack  
            Started by CaptainJack, 05-29-2026, 12:02 AM
            0 responses
            145 views
            0 likes
            Last Post CaptainJack  
            Started by charlesugo_1, 05-26-2026, 05:03 PM
            0 responses
            159 views
            1 like
            Last Post charlesugo_1  
            Started by DannyP96, 05-18-2026, 02:38 PM
            1 response
            237 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 05-11-2026, 05:56 AM
            0 responses
            197 views
            0 likes
            Last Post CarlTrading  
            Working...
            X