Call the refresh button from code on UD entry form

I’m trying to see if I can call a refresh from code. When I click on the screen one, it clears a partially entered form, which is what I want. I tried oTrans.Refresh() and it doesn’t clear.

I’m trying to see if I can use this, but it won’t compile, it says that AppControlPanel is not in the definition for UD10Form. Does anyone know how to call the refresh from the tool bar on a UD form?

UD10Form.AppControlPanel.HandleToolClick("RefreshTool", new 
Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(UD10Form.MainToolManager.Tools["RefreshTool"], null));

Did you get this to work? We are trying to do this as well.

refresh the UD epiDataView, with new key data.

I did not. The form worked well enough to do what we needed it to do, but not as well as I would have liked. Luckily for us, it will just be used for physical inventory, and only by certain trainable people, so we just lived with it.

was this the same thing as your really long thread with the unbound textbox? Just asking before I reply there

yeah. All the same project.

@Banderson,

Hey, I don’t know if this will help but I created a refresh button that does the same as hitting the built-in one.

Maybe you can pick it apart and use it in your code?

Add A REFRESH BUTTON to a customization.docx (16.0 KB)

1 Like

That’s the same as what I have at the beginning of the the thread. There is no MainController in the UD entry screen, so that’s why it’s UD10Form. But it doesn’t work.

just oTrans.Refresh() should do it. oh I’m sorry TLDR; LoL 2 secs.

Try this

//add using System.Reflection;
MethodInfo mi = typeof(EpiBaseForm).GetMethod("handleToolClick", BindingFlags.Instance | BindingFlags.NonPublic);
mi.Invoke(UD10Form, new object[]{"PrintClientTool",new Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(UD10Form.MainToolManager.Tools["RefreshTool"],null)});
2 Likes

I don’t need it anymore. @knash was the one who was asking. He contacted me offline and said he got it working. I’ll revisit someday when I want to learn something new.

Thanks for this discussion. I followed it as closely as I could but couldn’t get it to work. These are the errors I got. Do you have any idea what I might have done wrong?

Error: CS0708 - line 29 (77) - ‘Script.RefreshButton’: cannot declare instance members in a static class
Error: CS0708 - line 60 (108) - ‘Refresh_Click’: cannot declare instance members in a static class