FrmGeShouList.cs
上传用户:fzwcsgshou
上传日期:2022-07-30
资源大小:28414k
文件大小:3k
源码类别:

行业应用

开发平台:

Visual C++

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. namespace KTV
  9. {
  10.     public partial class FrmGeShouList : Form
  11.     {
  12.         public FrmGeShouList()
  13.         {
  14.             InitializeComponent();
  15.         }
  16.         private void FrmGeShouList_Load(object sender, EventArgs e)
  17.         {
  18.             dataGridView1.DataSource = ds.Tables[0];
  19.             dsList.Tables.Add();
  20.             dsList.Tables[0].Columns.Add("歌手编号");
  21.             dsList.Tables[0].Columns.Add("歌手姓名");
  22.             listBox1.DisplayMember = "歌手姓名";
  23.             listBox1.ValueMember = "歌手编号";
  24.             listBox1.DataSource = dsList.Tables[0];
  25.         }
  26.         public DataSet ds = new DataSet();
  27.         public DataSet dsList = new DataSet();
  28.         private void btnAdd_Click(object sender, EventArgs e)
  29.         {
  30.             dsList.Tables[0].Rows.Add();
  31.             dsList.Tables[0].Rows[dsList.Tables[0].Rows.Count - 1]["歌手姓名"] = dataGridView1.CurrentRow.Cells["歌手姓名"].Value.ToString();
  32.             dsList.Tables[0].Rows[dsList.Tables[0].Rows.Count - 1]["歌手编号"] = dataGridView1.CurrentRow.Cells["歌手编号"].Value.ToString();
  33.         }
  34.         private void btnDel_Click(object sender, EventArgs e)
  35.         {
  36.             dsList.Tables[0].Rows.RemoveAt(listBox1.SelectedIndex);
  37.         }
  38.         private void btnOk_Click(object sender, EventArgs e)
  39.         {
  40.             if (listBox1.Items.Count > 0)
  41.             {
  42.                 DataSet dsGeQu = new DataSet();
  43.                 int i = 0;
  44.                 for (int j = 0; j < listBox1.Items.Count; j++)
  45.                 {
  46.                     i = int.Parse(dsList.Tables[0].Rows[j]["歌手编号"].ToString());
  47.                     if (dsGeQu.Tables.Count < 1)
  48.                     {
  49.                         dsGeQu = KTVData.KTVDB.SelectGeShouDeGe(i);
  50.                     }
  51.                     else
  52.                     {
  53.                         dsGeQu.Merge(KTVData.KTVDB.SelectGeShouDeGe(i));
  54.                     }
  55.                 }
  56.                 FrmXuanGe FrmXuanGe1 = new FrmXuanGe();
  57.                 FrmXuanGe1.ds = dsGeQu;
  58.                 FrmXuanGe1.Show();
  59.                 this.Close();
  60.             }
  61.             else
  62.             {
  63.                 MessageBox.Show("没有选择不能确定,您可以直接退出放弃选择!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  64.             }
  65.         }
  66.         private void pictureBox1_Click(object sender, EventArgs e)
  67.         {
  68.             MessageBox.Show("需要硬件设备支持!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  69.         }
  70.         private void button1_Click(object sender, EventArgs e)
  71.         {
  72.             this.Close();
  73.         }
  74.     }
  75. }