How to default an EpiTextBox in customisation

HI
I’m trying to default the txtECO text box of the Part revision checkout form to a set value.
My on load code for the form is:

private void PartRevCheckoutEntryForm_Load(object sender, EventArgs args)
{
	// Add Event Handler Code
	etbECO = (EpiTextBox)csm.GetNativeControlReference("18ec4816-e90b-4c3d-8c70-aa4669204145");
	etbECO.Text = "BEMIS";
	MessageBox.Show(etbECO.Text);
}

The Message box shows the Text value changed but when the form actually loads it is blank. I’ve run a trace and can’t see any methods being called…
Once I can do this, I would like to click the “OK” button automatically as well (that’s going to be my next problem …)
What I would actually like to do is have the process “Check out revision”, enter the ECO, click OK and then open the Engineering workbench all in one go. Is that possible?

That control is most likely bound to a data source. So even if you set it during Form_Load, it will get overwritten with the value from the DB, or some initial value (probably blank) upon a new temp record being created.

Hi Calvin,
That makes sense. Is there a way of populating the text box after load?

Customizations aren’t my specialty. But maybe some other event like before/after adapter, or row change

Edit

But if I recall correctly, one shouldn’t change the values of bound controls, but rather change the underlying dataset.

[Puts up the @josecgomez bat signal ]

2 Likes
1 Like

Thanks. How does one do that?

Follow the link above and look for the solution.

2 Likes

The solution shows the code for updating the dataview, but not how (or when) to call that code. I assume it wouldn’t work in the FormLoad, as I dont think the dataview is setup just yet.

(Asking for a friend. :wink: )

I normally use EpiViewNotification for this kind of thing. That’s when the data stuff is happening and it’s the logical place to do what you need to that data.

The thread linked to is more about doing things while the user is interacting, though, so there’s a lot about field events in there, which also works for a different set of use cases.

1 Like

True. I just searched for DataView and Jose and this was one of the first results. Inspired by Brandon’s post on how to get help on this list, I wanted to show that searching the forum can be quicker and more educational than just asking for solutions. :wink:

4 Likes

So are you typing in the Part Number and the Rev Number?
image

And I am understanding you just want to default the Eco Group? Also how would you hit the button automatically ? When you need to specify a part and rev number?

Hi Jose
We always launch this form from the part form / revision tab / Actions menu:
2019-07-16%2007_50_33-Part%20Maintenance
2019-07-16%2007_50_04-Part%20Maintenance
When you do that it looks like this:
2019-07-16%2007_53_25-Part%20Maintenance