Auto Click Toolbar button

I wish to auto click the Save button on the Toolbar from my customization. I tried to do oTrans.Update() but get an error like the following.

Erp.UI.App.SerialNumberAssignmentEntry.Transaction’ does not contain a definition for ‘Update’ and no extension method ‘Update’ accepting a first argument of type ‘Erp.UI.App.SerialNumberAssignmentEntry.Transaction’ could be found (are you missing a using directive or an assembly reference?)

Can this be done and if so, what do I need to do to make it work?

Have you done a trace? While you might not be able to automate a click, you can recreate the functionality from the trace.

I use these two bits of code to access tools, maybe something similar will work for you.

private void ResetMe()
	{			
MainController.AppControlPanel.HandleToolClick("RefreshTool", new 	Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MainController.MainToolManager.Tools["RefreshTool"], null));
	}

private void ClearMe()
	{			
MainController.AppControlPanel.HandleToolClick("ClearTool", new 
Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MainController.MainToolManager.Tools["ClearTool"], null));
	}

You have to change the value in quotes to your save button. I am not sure what the text is, but I would try “SaveTool” or just “Save”.
Good luck!
Nate

1 Like

Thanks guys. I will try these suggestions.

I got a trace log that had GetSerialNoAssign using the SerialNoAssign implementation but wondered if there was a easier way or maybe a shorter way. This code provided here is working handsomely. Thanks for all of your help. I am not sure I would have ever been able to come up with this. I anticipate reusing this code many times in the days to come.

@skhan this bit of code will clear a form as if you hit the clear tool.

Not covered in ice customization guide I don’t think.

1 Like