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);




            }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM