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 argusthome, Yesterday, 10:06 AM
            0 responses
            22 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            19 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            14 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            10 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            41 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X