• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

dropdown list and selected Items on startup

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

    dropdown list and selected Items on startup

    I created a custom typeconverter dropdownlist

    [GridCategory("Parameters")]
    [TypeConverter(typeof(FileNameList))]
    public string TradeFiles
    {get;set;}


    It load but the error is
    Failed to get property 'TradeFiles' for indicator 'myindicator': Object reference not set to an instance of an object.

    the issue is the dropdownlist is initially blank when i select the name in in the dropdownlist and press apply it will then work.

    all i want to do is choose the first item in my dropdown list upon initialization

    #2
    Hello,

    Thank you for the post.

    I wanted to check, could you provide an export of the type converter/property into a sample script?

    A string would not be null in this situation so this is very likely something in the TypeConverter is not being initialized. If you could provide a sample I would be able to review that further to see if I can find anything else.

    You may also try supplying a default string if you are not already from SetDefaults:

    Code:
    TradeFiles = "whatever the default should be";
    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks Last question how to I get the value of the dropdown list?

      Comment


        #4
        Hello,

        The TypeConverter is only used to change how the property is displayed/selected, you still access the property if you want its value:

        Print(TradeFiles);

        You have defined a string property so it could be used anywhere a string is used.

        Please let me know if I may be of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by vpzdcv, Today, 02:31 AM
        0 responses
        7 views
        0 likes
        Last Post vpzdcv
        by vpzdcv
         
        Started by YevhenShynkarenko, Today, 01:22 AM
        0 responses
        12 views
        0 likes
        Last Post YevhenShynkarenko  
        Started by ttodua, Today, 12:52 AM
        0 responses
        6 views
        0 likes
        Last Post ttodua
        by ttodua
         
        Started by ttodua, Today, 12:50 AM
        0 responses
        5 views
        0 likes
        Last Post ttodua
        by ttodua
         
        Started by mulshah, Yesterday, 11:12 PM
        0 responses
        6 views
        0 likes
        Last Post mulshah
        by mulshah
         
        Working...
        X