private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderG = (DataGridView)sender; if (senderG.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { string id = senderG.Rows[e.RowIndex].Cells["Id"].Value.ToString(); DataTable dt = new DbHandler().SelectData("select mpath,mtype from Medias where mid=" + id); if (dt.Rows[0].ItemArray[1].ToString().Equals("Offline")) { MPlayer mp = new MPlayer(dt.Rows[0].ItemArray[0].ToString()); //mp.MdiParent = this.MdiParent; mp.Show(); } else { YPlayer yp = new YPlayer(dt.Rows[0].ItemArray[0].ToString()); yp.Show(); } } }
private void Library_Load(object sender, EventArgs e) { DataTable dt = new DbHandler().SelectData("select mid,adminid,mtitle,mdesc from Medias"); dataGridView1.DataSource = dt; }
private void ViewAll_Activated(object sender, EventArgs e) { DataTable dt = new DbHandler().SelectData("select mid,mtitle,mdesc,mtype,mpath from Medias where adminid='" + Form1.admin + "'"); dataGridView1.DataSource = dt; }