-1

I am making an ordering system and I want the orders of the customer to be display in the text box of an another form. Please help! Thank you..... btw it's a school project :(

This is the code of where I want to access the textbox:

if (cbo1.Checked != cbo2.Checked != cbo3.Checked)
{

    QuantityMSG qmsg = new QuantityMSG();
    qmsg.Show();

    int r = 0;
    quant(r, 45, "Buko Pandan                                                                                      P ");
    txtTotal.Text(" " + tot);
    //area1.append(" " + dish);

    cbo1.Checked = false;

}

The class of it is:

public partial class Menu : Form
{
    public Menu()
    {
        InitializeComponent();

    }

This is where the text box form:

public partial class Payment : Form
{
    public Payment()
    {
        InitializeComponent();
    }
aneroid
  • 12,983
  • 3
  • 36
  • 66
  • Welcome to the community. I understand that you were probably trying to draw attention to how desperate the situation is, but I'd recommend not typing in ALL CAPS. Some people will shy away from answering the question just based on that. – David Woodward Sep 18 '16 at 02:27

1 Answers1

0

First add a property to your Payment form:

 public string TextBoxValue
    {
        get { return txtTotal.Text;} 
        set { txtTotal.Text = value;}
    }  

And in the caller form (perhaps Menu) access it like this:

Payment payment = new Payment();
payment.TextBoxValue = "The value you want";
Mohsen Kamrani
  • 7,177
  • 5
  • 42
  • 66