I’m working on a custom Part Maintenance form that’s for a team to use to set the primary warehouse and bins. I basically hid all other tabs and have a custom blank sheet and created the relevant fields. The fields all work if manually entered but I wanted to mimic the standard buttons for Part and Bin search. I’ve done custom buttons with a search before to a UD field with similar code to below. But in this case it’s a standard table field, Part.PartNum but thought it’d work just a like a UD.
The code appears to work, clicking the button will open the Part Search dialog but the partnum isn’t passed back to the form. I’m sure I’m missing something stupid but can’t see what.
{
this.btnPartSearch.Click += new System.EventHandler(this.btnPartSearch_Click);
}
private void btnPartSearch_Click(object sender, System.EventArgs args)
{
SearchOnPartAdapterShowDialog();
}
private void SearchOnPartAdapterShowDialog()
{
bool recSelected;
string whereClause = string.Empty;
System.Data.DataSet dsPartAdapter = Ice.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "PartAdapter", out recSelected, true, whereClause);
if (recSelected)
{
System.Data.DataRow adapterRow = dsPartAdapter.Tables[0].Rows[0];
// Map Search Fields to Application Fields
EpiDataView edvPart = ((EpiDataView)(this.oTrans.EpiDataViews["Part"]));
System.Data.DataRow edvPartRow = edvPart.CurrentDataRow;
if ((edvPartRow != null))
{
edvPartRow.BeginEdit();
edvPartRow["PartNum"] = adapterRow["PartNum"];
edvPartRow.EndEdit();
}
}
}