Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form prob

Status
Not open for further replies.

darklucifer

Programmer
Joined
Jan 3, 2004
Messages
4
Location
GB
dear friends
im stuck in this program which i working for a cafee, it is about read the total from a form. when i click the button total a amother form well appiear where it allows user to put the cash in.... i created some thing like this but when ever i compile it opens a new form not the form with the total of the goods (this may confuce you any way this is the best way i can explain this). this maybe the matter that i call it "Welcome frm = new Welcome ();" just wondering is there any other way i can do this if so what is that?
any help you people can do is apprieciated


/*Welcome frm = new Welcome ();
double d = double.Parse (txtPayments.Text);
frm.TxtDisplay.AppendText("Payment is: " + d.ToString());
this.Close ();
frm.Visible = true;*/
 
OK, I'm not sure if I understand your problem, but you need to do three things.

1. Create a property in the dialog (form) you wish to display so that you can extract the information out of a textbox.

Code:
public class Welcome : System.Windows.Forms.Form
{
   ...
   
   public string Payment
   {
      get
      {
         return txtPayment.Text;
      }
   }
}
2. Make sure that the button on your dialog has the DialogResult set correctly.

3. Call the form like this:
Code:
private void OnClick(objecy sender, EventArgs e)
{
   Welcome wel = new Welcome();
   if (wel.ShowDialog() == DialogResult.OK)
        thePayment = wel.Payment;

   ...
}

I hope that helps. If not, I haven't understood the question.

Cheers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top