I have a form prompt that pops up and the user can enter a line number in it. I want to use this as the Line # to input into a BO update. I am running into an issue with how to declare a number box instead of a text box. Below is my code and it is the line:
TextBox inputBox
I need this to be a number or return a number and not a text string.
//Order - Cancel/Close Order Line
private void CallSalesOrderAdapterUpdateMethodCancelLine()
{
try
{
Form prompt = new Form();
prompt.StartPosition = FormStartPosition.CenterScreen;
prompt.Width = 200;
prompt.Height = 150;
prompt.Text = "Order Line";
Label textLabel = new Label() { Left = 15, Width=50, Top=20, Text="Order Line" };
//TextBox inputnumberBox = new NumberBox () { Left = 55, Top=20, Width=50, Height=23 };
**_TextBox inputBox = new TextBox () { Left = 55, Top=20, Width=50, Height=23 };_**
Button confirmation = new Button() { Text = "OK", Left=40, Width=100, Top=60 };
confirmation.Click += (sender, e) =>
{
if ((inputBox.Text == ""))
{
prompt.Close();
}
else
{
prompt.Close();
}
};
prompt.Controls.Add(confirmation);
prompt.Controls.Add(textLabel);
prompt.Controls.Add(inputBox);
prompt.AcceptButton = confirmation;
prompt.ShowDialog();
var orderNum = (int) edvGS_Order_Detail_DataView.dataView[edvGS_Order_Detail_DataView.Row]["OrderHed_OrderNum"];
**_var orderLine = (int) Convert.ToInt32(inputBox);_**
SalesOrderAdapter adapterSalesOrder = new SalesOrderAdapter(this.oTrans);
adapterSalesOrder.BOConnect();
adapterSalesOrder.CloseOrderLine(orderNum, orderLine);
adapterSalesOrder.Dispose();
}
catch (System.Exception ex)
{
ExceptionBox.Show(ex);
}
}