Button OnClick Event :: Call Method

I have inserted this method:

	private void SearchOnProdGrupAdapterShowDialog()
	{
		// Wizard Generated Search Method
		// You will need to call this method from another method in custom code
		// For example, [Form]_Load or [Button]_Click

		bool recSelected;
		string whereClause = string.Empty;
		System.Data.DataSet dsProdGrupAdapter = Ice.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "ProdGrupAdapter", out recSelected, true, whereClause);
		if (recSelected)
		{
			System.Data.DataRow adapterRow = dsProdGrupAdapter.Tables[0].Rows[0];

			// Map Search Fields to Application Fields
			EpiDataView edvMain = ((EpiDataView)(this.oTrans.EpiDataViews["Main"]));
			System.Data.DataRow edvMainRow = edvMain.CurrentDataRow;
			if ((edvMainRow != null))
			{
				edvMainRow.BeginEdit();
				edvMainRow["Group"] = adapterRow["ProdCode"];
				edvMainRow.EndEdit();
			}
		}
	}

What code do i need to run this when a button is clicked?

So you go under the Wizards Tab and there is the Form Wizard you can add a Click event to your button.

1 Like

That helps. But it gets me so far. What is the correct event handling code. Sorry, I am a C# newbie

Just call your method.

SearchOnProdGrupAdapterShowDialog()

SearchOnProdGrupAdapterShowDialog();

just put that in between the { and }

:man_facepalming: yup, don’t forget the ;