# C# syntax help within E10 customization layer

**URL:** <https://www.epiusers.help/t/c-syntax-help-within-e10-customization-layer/81620>\
**Category:** Epicor ERP 10\
**Tags:** customization\
**Created:** [August 16, 2021, 3:06pm UTC](https://www.epiusers.help/t/c-syntax-help-within-e10-customization-layer/81620 "2021-08-16T15:06:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MNlesta](https://www.epiusers.help/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@MNlesta](https://www.epiusers.help/u/MNlesta)\
**Post date:** [August 16, 2021, 3:06pm UTC](https://www.epiusers.help/t/c-syntax-help-within-e10-customization-layer/81620/1 "2021-08-16T15:06:45Z")

</div>

OK, time to throw in the towel and seek out help from those with a whole lot more C# knowledge than I. I’m almost there but can’t get that last step solved. I’m trying to invoke a quick search within a customization layer to return two values to fill two fields (std only supports one). I’ve got everything but the final step to fill the fields in the edv which will then display on the UI panel when complete. I’ve tried various permutations on this.oTrans and whatever examples I could find which seemed to be germane but to no avail. The std dataview is “POHeader”. Here’s the code I’ve got:

```
private void DIIbtnVendorID_Click(object sender, System.EventArgs args)
{
	// **Place Event Handling Code Here**
	object selected = ProcessCaller.InvokeAdapterMethod(oTrans.EpiBaseForm,"QuickSearchAdapter", "ShowQuickSearchForm", new object[]
	{oTrans.EpiBaseForm, "QS_PPointActive", false, new DataTable()});
	
	if (selected != null)
	{
		string Supplier = selected.ToString().Split(';')[0];
		string PurPoint = selected.ToString().Split(';')[1];
		// What now here??????
		EpiMessageBox.Show("it works!! " + Supplier + " " + PurPoint);
	}
}

```

THANKS! to those gurus out there who know C# better than lowly me. (lol)

---

<div class="post-metadata">

**Author:** ![josecgomez](https://www.epiusers.help/user_avatar/www.epiusers.help/josecgomez/32/55731_2.png) [@josecgomez](https://www.epiusers.help/u/josecgomez)\
**Post date:** [August 16, 2021, 3:12pm UTC](https://www.epiusers.help/t/c-syntax-help-within-e10-customization-layer/81620/2 "2021-08-16T15:12:20Z")

</div>

```auto
var edvPoHeader = oTrans.Factory("POHeader");
if(edvPoHeader.Row >=0)
{
     edvPoHeader.dataView[edvPoHeader.Row].BeginEdit();
     edvPoHeader.dataView[edvPoHeader.Row]["Field1"]=Supplier;
     edvPoHeader.dataView[edvPoHeader.Row]["Field2"]=PurPoint;
     edvPoHeader.dataView[edvPoHeader.Row].EndEdit();

}

```

---

<div class="post-metadata">

**Author:** ![MNlesta](https://www.epiusers.help/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@MNlesta](https://www.epiusers.help/u/MNlesta)\
**Post date:** [August 16, 2021, 3:35pm UTC](https://www.epiusers.help/t/c-syntax-help-within-e10-customization-layer/81620/3 "2021-08-16T15:35:23Z")

</div>

Thanks for the quick response Jose. Almost there. Compiles if I remove the Begin and EndEdit but doesn’t populate the data fields because the “if” conditional failed (message added inside the braces to trace what’s up and didn’t show). Not sure where the “Factory” came from - haven’t seen that one before now.

---

<div class="post-metadata">

**Author:** ![cfinley](https://www.epiusers.help/letter_avatar_proxy/v4/letter/c/3e96dc/32.png) [@cfinley](https://www.epiusers.help/u/cfinley)\
**Post date:** [August 16, 2021, 3:41pm UTC](https://www.epiusers.help/t/c-syntax-help-within-e10-customization-layer/81620/4 "2021-08-16T15:41:37Z")

</div>

What is the error message when you try to compile with beginedit and endedit in?

---

<div class="post-metadata">

**Author:** ![MNlesta](https://www.epiusers.help/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@MNlesta](https://www.epiusers.help/u/MNlesta)\
**Post date:** [August 16, 2021, 3:42pm UTC](https://www.epiusers.help/t/c-syntax-help-within-e10-customization-layer/81620/5 "2021-08-16T15:42:08Z")

</div>

ok, I got it to work!!! I just tweaked it a tad and now it all works. Here’s what I have:

```
private void DIIbtnVendorID_Click(object sender, System.EventArgs args)
{
	// **Place Event Handling Code Here**
	object selected = ProcessCaller.InvokeAdapterMethod(oTrans.EpiBaseForm,"QuickSearchAdapter", "ShowQuickSearchForm", new object[]
	{oTrans.EpiBaseForm, "QS_PPointActive", false, new DataTable()});
	
	if (selected != null)
	{
		string Supplier = selected.ToString().Split(';')[0];
		string PurPoint = selected.ToString().Split(';')[1];

		var edvPoHeader = ((EpiDataView)(this.oTrans.EpiDataViews["POHeader"]));
		if(edvPoHeader.Row >= 0)
		{
		    edvPoHeader.dataView[edvPoHeader.Row]["VendorVendorID"] = Supplier;
		    edvPoHeader.dataView[edvPoHeader.Row]["PurPoint"] = PurPoint;
			//EpiMessageBox.Show("Should fill!! " + Supplier + " " + PurPoint);
		}
		
		//EpiMessageBox.Show("it works!! " + Supplier + " " + PurPoint);
	}
}

```

}
