currently i am doing sms function by using window mobile standard 6.
i have multiple form, up to 4 window form.
and at the last form, i wish to collect all the data that already key in in previous form textbox text, and send message to people.

example:
in form 1: textBox1. text
form 2: textBox1.text
......
at the SMS form coding like:

{
SmsMessage messageFromForm1TextBox1 = new SmsMessage (textBox1.Text, "this text get from 1 textBox1")
messageFromForm1TextBox1.Send();

SmsMessage messageFromForm2TextBox1 = new SmsMessage (textBox1.Text, "this text get from 2 textBox1")
messageFromForm1TextBox1.Send();
}

kindly advice.
thx a lot

Recommended Answers

All 2 Replies

Make your textbox variables public and then select the text as follows:

{
SmsMessage messageFromForm1TextBox1 = new SmsMessage (form1.textBox1.Text, "this text get from 1 textBox1")
messageFromForm1TextBox1.Send();
 
SmsMessage messageFromForm2TextBox1 = new SmsMessage (form2.textBox1.Text, "this text get from 2 textBox1")
messageFromForm1TextBox1.Send();
}

DO NOT make controls public. This is the worse case possible. This is never a good way of (unsafe) coding.
You have other better options:
- by creating a method on form1 which can be access from form2 to access control on form2
- by using events

but in any case, you will need a reference of form2 (but I know you have it).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.