Pass Parameters to Form

Okay, I am finally back to working on this. I have a form that I am passing parameters from. My code in that form:

private void btnCreateNon_Conformance_Click(object sender, System.EventArgs args)
	{
	LaunchFormOptions lfo = new LaunchFormOptions();
	lfo.IsModal = true;
	lfo.SuppressFormSearch = true;
	System.Collections.Generic.Dictionary<string, string> mylist = new System.Collections.Generic.Dictionary<string, string>();
	mylist.Add("OpenRMA", "true");
	mylist.Add("CustID", "03061982");
	mylist.Add("CustNum", "24989");
	mylist.Add("RMANum", "0");
	mylist.Add("OrderNum", "1411");
	mylist.Add("OrderLine", "1");
	mylist.Add("OrderRel", "1");
	string valuein = "GetNewRMA";
	lfo.ValueIn = valuein;
	lfo.ContextValue = mylist;
	lfo.CallBackMethod = MyNonConCallBackHandler;
	ProcessCaller.LaunchForm(oTrans, "CRGO5000", lfo); 
	}

This is the code of the form receiving the information:

private static void RMAProcForm_Load(object sender, EventArgs args)
	{
		LaunchFormOptions opts = RMAProcForm.LaunchFormOptions;
		string CustID = string.Empty;
		if (opts != null && opts.ContextValue != null && opts.ValueIn != null)
            {
                Type lfotype = opts.ContextValue.GetType();
                if(lfotype == typeof(System.Collections.Generic.Dictionary<string, string>))
                {
					oTrans.GetNew();
					string value = opts.ValueIn.ToString();
					MessageBox.Show(value);
					MessageBox.Show("Start of Launch");
                    System.Collections.Generic.Dictionary<string, string> mylist = (System.Collections.Generic.Dictionary<string, string>)opts.ContextValue;
              
					string fldname = "";
                    string fldvalue = "";
                    foreach (System.Collections.Generic.KeyValuePair<string, string> pair in mylist)
                    {
                        fldname = pair.Key;
                        fldvalue = pair.Value;
                        switch (fldname)
                        {
                            case "CustID":
                                {
									MessageBox.Show("CustID");
                                    txtCustomerCustID.Text = fldvalue;
                                    break;
                                }
							case "CustNum":
							{
								break;
							}
							 case "OrderNum":
                                {
                                     txtOrderNum.Text = fldvalue;
                                    break;
                                }
							 case "OrderLine":
                                {
                                     txtOrderLine.Text = fldvalue;
                                    break;
                                }
							 case "OrderRel":
                                {
                                     txtRelease.Text = fldvalue;
                                    break;
                                }
                            
                            
                            default:
                                {
                                    break;
                                }
                        }
                    }

					MessageBox.Show(txtCustomerCustID.Text + ", " + txtKeyField.Text + ", " + txtOrderNum.Text + ", " + txtOrderLine.Text + ", " + txtRelease.Text);
                }
			}
		else 
			{
				//MessageBox.Show("Order number was not entered"); CustID = ""; return;  
			} 
}
}

I get the following when I click my button to launch the form: Get New RMA, Then another message box of CustID, then another message box of 03061982, 0,1411,1,1. It actually creates a new RMA but then it doesn’t enter in the Customer ID into the text box. Any ideas?

1 Like