I am working on a dashboard. The dashboard displays an active labor transaction. From that dashboard am am adding a button “btnRptQty” where when clicked it takes the values on the dashboard and passes them as LaunchFormOptions to the RQForm_Load. It should call the GetNewReportQty method and pass these values as the parameters.
I am not able to get it working. Getting this error, before the RQForm_Load triggers)
Index 0 is either negative or above rows count.
I see that the GetNewReportQty is being called after the RQForm_Load. My problem is I don’t know how to pass these custom parameters to GetNewReportQty… yet I get an error even before the form loads…
This is the code I have on the dashboard for the Report Quantity button:
private void btnRptQty_Click(object sender, System.EventArgs args)
{
LaunchFormOptions lfo = new LaunchFormOptions();
NameValueCollection collection = new NameValueCollection();
collection.Add("empID", strEmpID);
collection.Add("DtlLaborHedSeq", strDtlLaborHedSeq);
collection.Add("DtlLaborDtlSeq", strDtlLaborDtlSeq);
string valuein = "GetNewReportQty";
lfo.IsModal = true;
lfo.SuppressFormSearch = true;
lfo.ValueIn = valuein;
lfo.ContextValue = collection;
ProcessCaller.LaunchForm(oTrans, "RptQty", lfo);
}
This is the code on the RQForm_Load:
private void RQForm_Load(object sender, EventArgs args)
{
MessageBox.Show("load");
LaunchFormOptions opts = RQForm.LaunchFormOptions;
if(opts != null && opts.ContextValue != null && opts.ValueIn != null)
{
MessageBox.Show(opts.ValueIn.ToString());
object inObj = RQForm.LaunchFormOptions.ContextValue;
NameValueCollection collection = new NameValueCollection();
collection = (NameValueCollection)inObj;
empID = collection["empID"];
DtlLaborHedSeq = Convert.ToInt32(collection["DtlLaborHedSeq"]);
DtlLaborDtlSeq = Convert.ToInt32(collection["DtlLaborDtlSeq"]);
//MessageBox.Show(empID + " - " + DtlLaborHedSeq.ToString() + " - " + DtlLaborDtlSeq.ToString());
}
}
What needs to change here to pass these custom parameters to GetNewReportQty so RQForm opens with a new record with current empID, DtlLaborHedSeq and DtlLaborDtlSeq?