我现在gridview里有多条记录。每条记录都有自己的编号。自己写了一个Approve()方法。
向通过这个方法来实现 点击BUTTON时就依次把gridview里面的每条记录读取到另外一个窗体中并弹出这个窗体。
现在遇到困难就是比如我增加了3条记录在gridv里。编号分别是1,2,3. 点击BUTTON时第一个弹出的窗体编号是1,没有错。
但是关掉这个后,弹出的第二个窗体和第三个窗体的编号这一字段都是1.现在就想问问高手们怎么让第二个窗体的字段是2,第三个是3. 应用的是Winform。           在线等  火速结贴。

解决方案 »

  1.   

         这个是方法。
       private void ApproveVouch()
            {                        DbUtil db = null;
                try
                {
                    db = new DbUtil();
                    if (db.ApprovePrepareVouch(this.textBox7.Text,this.user_id))
                    {
                        MessageBox.Show("成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        this.isapprove = true;
                        if (MessageBox.Show("是否增加详细信息?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                        {
                            this.toolStripButton7.Enabled = false;
                            this.toolStripButton1.Enabled = false;
                            this.toolStripButton5.Enabled = false;
                            this.toolStripButton6.Enabled = false;                        this.toolStripButton10.Enabled = true;
                            this.toolStripButton9.Enabled = true;
                        }
                        else
                        {
                            for (int i = 0; i < this.gridView1.RowCount; i++)
                            {
                                if (this.gridView1.SelectedRowsCount == 0)
                                    return;
                                string barcode = "";//当前所选编号
                                DataRow dr = this.gridView1.GetFocusedDataRow();
                                barcode = dr.ItemArray[0].ToString();
                                FrmAssetAdd frmadd = new FrmAssetAdd(this.user_id);
                                frmadd.currBarcode = barcode;
                                frmadd.isShowMode = true;
                                frmadd.FormBorderStyle = FormBorderStyle.FixedToolWindow;
                                frmadd.WindowState = FormWindowState.Normal;
                                frmadd.StartPosition = FormStartPosition.CenterScreen;
                                frmadd.Text = "信息";
                                frmadd.ShowDialog();
                            }
                        }
                    }                
                }
                catch (Exception _e)
                {
                    MessageBox.Show(_e.Message);
                }                      
            }
      

  2.   

    这个是BUTTON
            private void toolStripButton7_Click(object sender, EventArgs e)
            {
                if (MessageBox.Show("确定审核当前" + this.textBox7.Text + "出库单吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    return;
                ApproveVouch();
                this.RefreshList(); //刷新        }
      

  3.   

    在点击toolStripButton7前,先要点击另外一个BUTTON把填写好的记录保存到gridview里面,在gridview里面是默认第一条记录为已点击的状态了,这个要求是这样的,不做修改。所以之前的BUTTON在这不重要,我想说的就是弹出新窗体里面的编号字段就肯定是1, 怎么让后面的2个窗体分别是2,3