How to use VB to access a field on a form

This should be a very easy question, but I’m still getting used to the backend coding in Epicor 10. The customizations I’ve created was using C# coding. Which is fine. It’s not intuitive but push in the right direction and I’m good.

Believe it or not, I am more of a VB guy, but the backend coding in Epicor uses objects and adaptors that has added a level to what I’m used to. I’m used to having direct access to forms and controls. I’ve created a button on the Quote Entry form and all I want to do is set a value from one EpiTextBox on the form to another EpiTextBox. Using VB, I would normally write the button_click like:

  me.txtField2 = me.txtField1

… no big deal. Epicor doesn’t make it that easy. What is the Epicor VB syntax that would allow me to do this?

This is the biggest change most coders see with the ICE framework. ALWAYS update the dataview. In VB, the form field is bound tightly with the form. In Epicor, the dataview is the source of truth. When a user fills a field, it doesn’t get updated until the dataview is updated through a BO call. If you set the dataview that the control is bound to (and fresh the UI), you’ll get the behavior you’re looking for. It’s just a different way of doing things.

1 Like

Mark, Thank you for responding and I appreciate what you’ve stated here. This is what I see when attempting to access the dataview. This is one of the specific fields I’m trying to access when placing a breakpoint on the Quote/Entry form, following the tabs; Line > Worksheet > Worksheet … my button is within the Calculations group box.

 edvQuoteQty.dataView.Table.Columns.Contains("BurdenMarkUp")

When trying to print this within the immediate window, this is the error message I see:

error BC30451: 'edvQuoteQty' is not declared. It may be inaccessible due to its protection level.

I believe it has been declared because it’s being used in an existing Private Sub. Not this specific field or column name but this object path is being used.

Should I be searching within oTrans or some other container?

Switch to C# while you still can :slight_smile:

lol … I can’t. A customization has already been created prior to this and is being used in production using VB. The C# option doesn’t seem to be available any more. I am a bit new to Epicor (which I’m sure you can tell) and still learning it.

You need to create a new layer and then one bit at a team convert your VB to C#.


Back to your original question.

You need something like this:

Dim edvQuoteQty As EpiDataView = CType(Me.oTrans.EpiDataViews("QuoteQty"),EpiDataView)
Dim Burden As Decimal = edvQuoteQty.dataView(edvQuoteQty.Row)("BurdenMarkUp")

For example to change the value

edvQuoteQty.dataView(edvQuoteQty.Row)("BurdenMarkUp") = 123
1 Like

Very Nice! This example you’ve shown works. Thank you!

I’ll use this to see if I can get it to do everything I need to. Huge help!!!