0
votes

I'm trying to add the OnChange or Changed or IndexChanged event to the "Drop-down list box" control in InfoPath using VS Tools for applications.

If found the following code how this is done with buttons:

((ButtonEvent)EventManager.ControlEvents["ButtonName"]).Clicked += new ClickedEventHandler(FormCode_Clicked);

I would think this is also possible with other controls, but I can't seem to find the cast object to be able to add the event to my drop-down list.

((?)EventManager.ControlEvents["Project_x0020_Number"]).SelectedIndexChanged += new EventHandler(FormCode_SelectedIndexChanged);

I tried the object ComboBox, but then their was an error that this object could not be casted to the type ComboBox.

I hope someone can give me some advice. All I want to do is basically run a Query that filters my data depending on the selected value in my "Project Number" box.

maybe also good to mention: I'm changing the form that will go in a word document (used as template in SharePoint). I don't really think this matters, but thought I mention it any way.

Thanks in advance

Oxillery

1

1 Answers

0
votes

You can approach this problem without writing code. I dont have Infopath in this machine to give you a sample. But I think you can solve this with the method described here in point 26:

http://www.bizsupportonline.net/infopath2003/avg-function-infopath.htm

Instead of calculating the average as in the example above you will set some parameters in your datasource and perform a refresh based on the value set in your dropdown.