@PsychoCoder
Hi PsychoCoder,
Anyway thanks for your reply.
my question is:
I'm currently developing under Windows Moblie system.
There are two WinForms. One is called "Setting" Form and anthor is "ShowList" Form.
Setting Form has
a ComboBox for user to choose a GPS MeasureMethod,
a CheckBox indicates whether he/she is a superuser,
a Textbox stores user's name,
and a Next Button.
ShowList Form has
a ListView with three columns
[username, MeasureMethod,authority ].
The workflow is the user first set all controls in Setting Form. then click the "Next" Button to show ShowList Form.
The ShowList Form will automatically add usename, GPS MeasureMethod and authority to the ListView.
Code are:
First, I define a public GetSettingValue in Common.cs
-
public class Common
-
{
-
.....
-
public static string[] m_setInfo = new string[3];
-
public static void GetSettingValue(TextBox tbx, ComboBox cbx, CheckBox Ckx)
-
{
-
-
setInfo[0]= serName;
-
setInfo[1]= cbx.Text;
-
setInfo[2]= ckx.Checked.ToString();
-
return setInfo
-
}
-
.....
-
}
-
then, get the seting infomation in Setting.cs
-
public partial class Setting : Form
-
{
-
....
-
private void Next_Click(object sender, EventArgs e)
-
{
-
Common.GetSettingValue((TextBox1,ComboBox1,CheckBox1));
-
}
-
....
-
}
-
third,show the seting infomation in ShowList.cs
-
public partial class ShowList: Form
-
{
-
....
-
private void ShowList_Click(object sender, EventArgs e)
-
{
-
.......
-
-
int loopi = listItems.Count;
-
string rowValue = new string { Common.m_setInfo[0],Common.m_setInfo[1],Common.m_setInfo[2] };
-
ListViewItem item = new ListViewItem(rowValue);
-
listtoAdd.Items.Add(item);
-
.............
-
-
}
-
....
-
}
-
althrough the way can get the thing done
but I think it's not convenient.
so I'm wondering whether there is a better way or a design pattern to implement the function that I want.