Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8490877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:15:12+00:00 2026-06-10T22:15:12+00:00

I’m putting together a custom control flow SSIS task for the first time in

  • 0

I’m putting together a custom control flow SSIS task for the first time in C#. On my task UI editor I have a property grid and in one of the options I would like to be able to populate a drop down list of any task variables available as well as give the user the option of creating a new one. I’ve been researching for a few days and I have found some good examples on the forum but I’m a little lost now. My code as follows compiles and the editor displays a drop down list but its blank. After stepping through it, it appears to be down to this line:

taskHostProperty = context.Instance.GetType().GetProperty("TransferTask", typeof(TaskHost));The "TransferTask" being the name of my control flow task.  I'm wondering if this is correct?  

My full code for this is below.

//Property Grid Property
  [Category("General"),
            Description("Specifies the local Path for this task"),
            Browsable(true),
            ReadOnly(false),
            DesignOnly(false),
            TypeConverter(typeof(VariableConverter)),
            DisplayName("Local Path")]            
            public string LocalPath
            {
                get
                {
                    return this.stLocalPath;
                }
                set
                {                    
                    dtsVariableService = serviceProvider.GetService(typeof(IDtsVariableService)) as IDtsVariableService;
                    dtsVariableService.PromptAndCreateVariable(parentWindow, dtsContainer,"Local Path","User",typeof(string));
                    this.stLocalPath = value;
                }
            } 
//Variable Converter
internal class VariableConverter : TypeConverter
        {
            StandardValuesCollection svc = new StandardValuesCollection(new ArrayList());
            public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
            {
                return true;
            }
            public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
            {
                TaskHost taskHost = null;
                PropertyInfo taskHostProperty = null;
                List<string> values = new List<string>();
                values.Add(NEW_VARIABLE);
                if (context == null)
                {
                    return svc; 
                }
                if (context.Instance == null)
                {
                    return svc;
                }
                taskHostProperty = context.Instance.GetType().GetProperty("TransferTask", typeof(TaskHost));
                if (taskHostProperty == null)
                {
                    return svc;
                }
                taskHost = taskHostProperty.GetValue(context.Instance, null) as TaskHost;

                foreach(Variable v in taskHost.Variables)
                {
                    if (!v.SystemVariable && v.DataType == TypeCode.String)
                    {
                        values.Add(v.QualifiedName);
                    }
                }
                values.Sort();
                return new StandardValuesCollection(values);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:15:14+00:00Added an answer on June 10, 2026 at 10:15 pm

    In the end I gave up trying to add the variables to a property grid and just created my own form. I used the following code to populate a combobox and after allowing the user to add a new SSIS variable. I refreshed the datasource. I would still like to know how to do this properly but I just didnt have the time to sit and work it out.
    I used the following to first get the SSIS variables I needed, I’m able to add a new SSIS variable and I’m able to select the newly created one. I’m sure there is a better way of doing this but this works for now.

    public ObservableCollection<string> FillVariableList()
            {
                ObservableCollection<string> variables = new ObservableCollection<string>();
    
                variables.Add(string.Empty);
                variables.Add(New_Variable);        
    
                foreach (Variable v in thetaskHost.Variables)
                {
                    if (!v.SystemVariable && v.DataType == TypeCode.String && !variables.Contains(v.Name))
                    {
                        variables.Add(v.Name);                  
                    }
                }
    
                return variables;
            }
    

    And I used the following to allow the user to add a new SSIS variable or select an existing SSIS variable and to refresh the SSIS variable combobox.

    private void cmbxVariables_SelectionChangeCommitted(object sender, EventArgs e)
        {
            if (cmbxVariables.Text == New_Variable)
            {
                try
                {
                    DtsContainer dtsContainer = null;
                    dtsVariableServie = serviceProvider.GetService(typeof(IDtsVariableService)) as IDtsVariableService;
                    Variable var = dtsVariableServie.PromptAndCreateVariable(null, dtsContainer, "VariableName", "User", typeof(string));
                    if (!var.IsNull())
                    {
                        cmbxVariables.DataSource = null;
                        cmbxVariables.DataSource = FillVariableList();
                    }
                }
                catch (Exception exe)
                {
                    MessageBox.Show(exe.ToString());
                }
            }
            else
            {
                foreach (Variable v in thetaskHost.Variables)
                {
                    if (v.Name == cmbxVariables.Text)
                    {
                        //Do something with the variable selected
                        break;
                    }
                }
            }          
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm making a simple page using Google Maps API 3. My first. One marker
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.