-1

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

Edited by __avd: added [code] tags.

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Mitja Bonca
-1

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();
}
0

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).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.