示例#1
0
 private void button17_Click(object sender, EventArgs e)
 {
     new Thread(() =>
     {
         button17.Enabled = false;
         //DoWork;
         textBox1.Text   = "";
         string province = "";
         string mycity   = "";
         string myarea   = "";
         string txt      = "";
         for (int i = 0; i < checkedListBox1.Items.Count; i++)
         {
             if (checkedListBox1.GetItemChecked(i))
             {
                 province       = checkedListBox1.GetItemText(checkedListBox1.Items[i]);
                 int index      = PCA.GetIndex(province);
                 string[] citys = PCA.getcity(index);
                 if (citys != null)
                 {
                     for (int j = 0; j < citys.Length; j++)
                     {
                         mycity = citys[j];
                         if (mycity.Trim() != "")
                         {
                             txt += mycity + "\r\n";
                         }
                     }
                 }
             }
         }
         if (txt != "")
         {
             txt = txt.Substring(0, txt.LastIndexOf("\r\n"));
         }
         textBox1.Text    = txt;
         groupBox1.Text   = string.Format("地名,共有{0}行", textBox1.Lines.Length);
         button17.Enabled = true;
     }).Start();
 }
示例#2
0
 private void frmareacs_Load(object sender, EventArgs e)
 {
     string[] ps = PCA.getprovince();
     checkedListBox1.Items.AddRange(ps);
     //button1_Click(null,null);
 }