zoukankan      html  css  js  c++  java
  • 在页面2中显示页面1中的注册信息

    1、打开Microsoft Visual Studio 2010 Express for Windows Phone 新建2个page页面,并且布局两个页面如下图所示:

    MainPage.xaml页面:

    2.xaml页面:

    2、添加一个DataTransferClass类:

    DataTransferClass.cs类
     public class DataTransferClass
        {
            public string name { get; set; }
            public string password { get; set; }
            public string sex { set; get; }
            public string like { set; get; }
            public string city { set; get; }
        }

    3、页面MainPage.xaml代码:

    单击 重置 按钮
     private void button2_Click(object sender, RoutedEventArgs e)
            {
                txtName.Text = "";
                passWord.Password = "";
                checkBox1.IsChecked = false;
                checkBox2.IsChecked = false;
                checkBox3.IsChecked = false;
                checkBox4.IsChecked = false;
            }
    单击 提交按钮
     private void button1_Click(object sender, RoutedEventArgs e)
            {
                //性别
                if (txtName.Text == "" || passWord.Password == "")
                {
                    MessageBox.Show("请核对信息!!!");
                }
                else
                {
                    string sex1 = "";
                    if (radioButton2.IsChecked==true)
                    {
                        sex1 = "";
                    }
                    //爱好
                    string like1 = "";
                    if (checkBox1.IsChecked == true || checkBox2.IsChecked == true || checkBox3.IsChecked == true || checkBox4.IsChecked == true)
                    {
                        string a="";
                        string b="";
                        string c="";
                        string d="";
                        if (checkBox1.IsChecked == true)
                        {
                            a = " 篮球";
                        }
                        if (checkBox2.IsChecked == true)
                        {
                            b = " 爬山";
                        }
                        if (checkBox3.IsChecked == true)
                        {
                            c = " 跑步";
                        }
                        if (checkBox4.IsChecked == true)
                        {
                            d = " 游泳";
                        }
                        like1 = a + b + c + d;
                    }
                    else
                    {
                        like1 = "";
                    }
                    //地址
                    string sdr = "";
                    ListBoxItem selectItem = listBox1.SelectedItem as ListBoxItem;
                    sdr = selectItem.Content.ToString();
    
                    App.Datatradition = new DataTransferClass
                    {
                        name = txtName.Text.Trim(),
                        password = passWord.Password.Trim(),
                        sex=sex1,
                        like=like1,
                        city=sdr
                    };
                    this.NavigationService.Navigate(new Uri("/2.xaml", UriKind.Relative));
                }
            }

    运行即可实现在页面2中显示页面1中的注册信息。

  • 相关阅读:
    Codeforces 631D Messenger KMP
    Google Codejam 2016 Round1A Problem C BFFs 简单图论
    ACM常用数论知识 总结
    C++ 虚函数表
    HDU 5661 Claris and XOR 贪心
    2013亚洲区域赛长沙站 ZOJ 3732 Graph Reconstruction
    [C++] upper_bound和lower_bound
    2015合肥网络赛 HDU 5489 Removed Interval LIS+线段树(树状数组)
    hdu 3532 Max Angle(atan2的使用)
    poj 1106 Transmitters (计算几何,叉积||极角排序)
  • 原文地址:https://www.cnblogs.com/wynet/p/2777834.html
Copyright © 2011-2022 走看看