C# winform程序中datagridview里按钮的单击事件

        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            string buttonText = this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
            if (buttonText == "更新")
            {
                string url = this.dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
                string aid = this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
                string imageURL = "http://m119.mail.qq.com" + this.GetImageURL(url);
                string newImage = this.CreateImage(imageURL, aid);
                this.dataGridView1.Rows[e.RowIndex].Cells[7].Value = System.Drawing.Image.FromFile(newImage);
            }
            if (buttonText == "提交")
            {
                string userInput = this.dataGridView1.Rows[e.RowIndex].Cells[9].Value.ToString();
                if (userInput.Length != 4)
                {
                    MessageBox.Show("貌似你输入不正确");
                    return;
                }
                string url = this.dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
                string aid = this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
                Regex reg = new Regex("&re=(.+?)&");
                string re = this.RegStr(reg,url);
                Regex rego = new Regex("&sg=(.+?)$");
                string sg = this.RegStr(rego, url);




            }

 

你可能感兴趣的:(datagridview)