LaunchFormOptions For Rcv Print Labels

I’m trying to debug an error I’m getting when I’m calling the Print Labels screen from Receipt Entry. The call is custom through ProcessCaller, because I’m passing in some values that aren’t native to the form.

image

This is the error, I’m passing in size 3 string array. What I’d like to do is see exactly what the form is expecting when it’s called, because no matter what I send in I get this error, even a very large array.

I found this post and it seems to describe what I want to do, I just have no idea how it was done. If anyone could explain how I can get the methods from the RcvLabelForm that’s what I’m after.

My understanding is you should be able to pass any object into the form via the LFO, but you’ll need to parse it inside the receiving form in order to consume the data correctly. Do you want to share your code as a reference?

//this snippet shows how one can pass data from one form to another using the LaunchFormOptions class

//in your form where you are passing data from, instantiate a new LaunchFormOptions class

LaunchFormOptions lfo = new LaunchFormOptions();
lfo.ContextValue = yourValue;

//your value can be any object. In this example, I'm going to pass an EpiDataView into another form using LaunchFormOptions
EpiDataView edvOrderHed = (EpiDataView)oTrans.EpiDataViews["OrderHed"];
LaunchFormOptions lfo = new LaunchFormOptions();
lfo.ContextValue =  edvOrderHed;
//Then, call your form by MenuID that you are passing the data into
ProcessCaller.LaunchForm(oTrans, "MYMENUID", lfo);

//in the recipient form, you will need a way to accept the launch form options
//make sure to define the datatype of the LaunchFormOptions
private void UD01Form_Load(object sender, EventArgs args)
{
  if(UD01Form.LaunchFormOptions !=null)
  {
    edvCustomView = (EpiDataView)UD01Form.LaunchFormOptions.ContextValue;
    if(edvCustomView !=null)
    {
      //do stuff with the now filled out edvCustomView
    }
  }
}

Yes absolutely. This first section is the code for calling the form.

private void NewTool_ToolClick(object sender,Infragistics.Win.UltraWinToolbars.ToolClickEventArgs args)
    {
	string[] options = new string[] {txtpack.Text, txtline.Text, txtpnum.Text};
	LaunchFormOptions lfo = new LaunchFormOptions();
	lfo.ValueIn = options;
	ProcessCaller.LaunchForm(oTrans, "PR000378", lfo);
    }

And then here is the code for receiving the data.

if (RcvLabelForm.LaunchFormOptions != null && RcvLabelForm.LaunchFormOptions.Sender != null && RcvLabelForm.LaunchFormOptions.ValueIn != null){

	var values = RcvLabelForm.LaunchFormOptions.ValueIn as string[];
	int qtyHold = 0;
	slip = values[0];
	string line = values[1];
	string ponum = values[2];
}

I see you use ContextValue instead of ValueIn, maybe that’s the issue with mine?

Yea try that, I’m curious

Well I didn’t get the error this time, but it broke the functionality of the Print Labels form. When the form opens it should default the Quantity Per Tag, and the dropdown on Printer should have the installed printers, but now it doesn’t have either.
image

Below is what it should look like, unfortunately I can’t show it, but the dropdown here does have the printer list.
image

you might need to set the epidataview values in the print labels form from your contextvalues object in order to get that portion to work, but at least you got the passing of the data resolved

Here’s an example of printing AR Invoices by modifying the epidataview:

private void btnPrint_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		txtNumberInvoicesSent.Value = 0;
		if (dtInput.Rows.Count<1){ MessageBox.Show("No Invoices Selected for Print"); 
		return;}
		EpiDataView dvRP = (EpiDataView)oTrans.EpiDataViews["ReportParam"];
		string workID = oTrans.WorkStationID.ToString();
		try {
			foreach (DataRow dr in dtInput.Rows)
			{
				dvRP.dataView[dvRP.Row]["InvoiceNum"] = dr["Invoice"];
				dvRP.dataView[dvRP.Row]["AutoAction"] = "SSRSPREVIEW";
				dvRP.dataView[dvRP.Row]["WorkstationID"] = workID;
				dr["Printed"] = true;
				oTrans.Update();					
				oTrans.SubmitToAgent("SystemTaskAgent", 0, 0);
				Thread.Sleep(500);
			}
			
			txtNumberInvoicesSent.Value = dtInput.Rows.Count;
			oTrans.PushDisposableStatusText("Reports Submitted for Preview...", true);
		}
		catch (Exception ex)
		{
		MessageBox.Show(ex.Message);
		}
	}

Actually the data being passed wasn’t the problem. I should’ve said this earlier in the post, but the form works exactly as it should, the only issue is that error that pops up whenever you open the form. Even if I could just find a way to prevent that error from popping up, that would solve my issues.

It looks like the ValueIn method is expecting a string, and you’re passing it a string array. Perhaps it’s consuming it, but when you try to parse it in the form, it can’t index a string array when it’s been converted to a string. Hard to say exactly, but that’s my guess

Same error came up when I tried to pass and receive a single string.

@josecgomez The .NET Reflector you used in the linked post; Can I use the free version to do exactly what you did, (except on RcvLabelForm instead) or do I need to purchase a license?

There are free ones out there yes that do similar. JetBrains has one I believe.

dotPeek