3

I'm having a real problem trying to set a custom property of a data flow component I've created through a custom form.

The value I'm assigning is just now being set, the custom property either remains the original value or stays null.

In my TaskClass I've overridden the ProvideComponentProperties() method and I've created the custom property as shown below.

IDTSCustomProperty100 componentCustomProperty = ComponentMetaData.CustomPropertyCollection.New();
componentCustomProperty.Name = "PAFProvider";
componentCustomProperty.Description = "PAF Provider";
componentCustomProperty.Value = "testinitial";

I've created a TaskClassUI which inherits from the IDtsComponentUI interface. I implement all required methods.

My Initialise method.

public void Initialize(IDTSComponentMetaData100 dtsComponentMetadata, IServiceProvider serviceProvider)
{
       this._dtsComponentMetaData = dtsComponentMetadata;
            this._serviceprovider = serviceProvider;

}

The implementation of my Edit Method

 public bool Edit(IWin32Window parentWindow, Variables variables, Connections connections)
    {
        bool flag;
        try
        {
            PAFUIMainWnd ui = new PAFUIMainWnd(this._dtsComponentMetaData, this._serviceprovider, connections);
            DialogResult result = ui.ShowDialog(parentWindow);
            bool flag1 = result != DialogResult.OK;
            if(!flag1)
            {
                flag = true;
                return flag;
            }
        }
        catch(Exception exe)
        {
            MessageBox.Show(exe.ToString());
        }
        flag = false;
        return flag;            
    }

And the implementation of my UIFORM.

public PAFUIMainWnd(IDTSComponentMetaData100 iDTSComponentMetaData100, IServiceProvider serviceProvider, Connections connections)
        {            
            this.components = null;
            this.InitializeComponent();
            this._dtsComponentMetaData = iDTSComponentMetaData100;     
            this._designTimeComponent = this._dtsComponentMetaData.Instantiate();
            textBox1.Text = _dtsComponentMetaData.CustomPropertyCollection["PAFProvider"].Value.ToString();

        }

And just for testing purposes I've stuck a textbox and a button on my form. The OnClick even for the button is below. I'm just taking the value from the textbox and assigning it to the Custom Property but its not assigning it. I can read the original value from the Custom Property which I assign to the text box. I just dont understand why I can't assign it. I've followed the MSDN and various other examples through completely. If anyone can point out what I've done wrong I would be very greatful. Its gotten to the head banging stage.

 private void btnOK_Click(object sender, EventArgs e)
    {
       _designTimeComponent.SetComponentProperty("PAFProvider", textBox1.Text);           

        this.Close();
    }
zeencat
  • 589
  • 1
  • 5
  • 26
  • 1
    It wouldn't have anything to do with your explicit assignment of the `flag` variable to false in your Edit method, would it? Too many nots in there for my brain to parse. – billinkc Nov 28 '12 at 17:19
  • It doesn't have anything to do with that but I'll remove it anyway. Its not needed. Thanks for the spot. I'm going to reboot my machine as suggested by a nondeveloper but how thats going to help I dont know. Although at this point I'll try anything. – zeencat Nov 28 '12 at 17:33
  • You might want to look into http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.taskhost.innerobject.aspx There is a difference between a task and the taskHost in SSIS's API. I remember having a similar issue using EzAPI and trying to set properties on an Execute SQL Task. – Kyle Hale Dec 04 '12 at 17:04
  • This is a data flow component so I don't access the Task or TaskHost which I use in a control flow component. I solved this last night. It turned out I just had to restart my computer. I can only assume it was something to do with the assembly register. Thanks Anyway. – zeencat Dec 05 '12 at 09:31

1 Answers1

0

A restart fixed this. The code was perfectly fine.

zeencat
  • 589
  • 1
  • 5
  • 26