FrmXuanGe.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 FrmXuanGe : Form
  11.     {
  12.         public FrmXuanGe()
  13.         {
  14.             InitializeComponent();
  15.         }
  16.         private void FrmXuanGe_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.         }
  27.         public DataSet ds = new DataSet();
  28.         public DataSet dsList = new DataSet();
  29.         private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
  30.         {
  31.         }
  32.         
  33.         
  34.         
  35.         private void button1_Click(object sender, EventArgs e)
  36.         {
  37.             int i = 0;
  38.             dsList.Tables[0].Rows.Add();
  39.             i = dsList.Tables[0].Rows.Count - 1;
  40.             
  41.             dsList.Tables[0].Rows[i]["歌曲名称"] = dataGridView1.CurrentRow.Cells["歌曲名称"].Value.ToString()+"--"+
  42.                 dataGridView1.CurrentRow.Cells["歌手"].Value.ToString();
  43.             dsList.Tables[0].Rows[i]["存放位置"] = dataGridView1.CurrentRow.Cells["存放位置"].Value.ToString();
  44.             KTVData.KTVDB.DianBo(int.Parse(dataGridView1.CurrentRow.Cells["歌曲编号"].Value.ToString()));
  45.         }
  46.         private void button2_Click(object sender, EventArgs e)
  47.         {
  48.             dsList.Tables[0].Rows.RemoveAt(listBox1.SelectedIndex);
  49.         }
  50.         
  51.         private void button3_Click(object sender, EventArgs e)
  52.         {
  53.             if (listBox1.Items.Count > 0)
  54.             {
  55.                 if (FrmMain.FrmBoFang1.listBox1.Items.Count < 1)
  56.                 {
  57.                     FrmBoFang.ds.Merge(dsList.Tables[0]);
  58.                     FrmMain.FrmBoFang1.axWindowsMediaPlayer1.URL = FrmMain.FrmBoFang1.listBox1.SelectedValue.ToString();
  59.                 }
  60.                 else
  61.                 {
  62.                     FrmBoFang.ds.Merge(dsList.Tables[0]);
  63.                 }
  64.             }
  65.                
  66.             this.Close();
  67.             
  68.         }
  69.         private void pictureBox1_Click(object sender, EventArgs e)
  70.         {
  71.             MessageBox.Show("需要硬件设备支持!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  72.         }
  73.     }
  74. }