.Net常用技巧_隐藏/显示DataGridView的行/等待框(转)

2020-12-13 03:37

阅读:460

标签:datagridview   style   blog   color   os   io   

//當主表選擇行更改後,顯示相應的採購資料
        private void dgvMain_SelectionChanged(object sender, EventArgs e)
        {
            if (this.dgvMain.SelectedRows.Count > 0 && this.dgvItem.DataSource != null && this.dgvItem.Rows.Count > 0)
            {
                string fMaterielCode = this.dgvMain.SelectedRows[0].Cells["colMfMaterialCode"].Value.ToString().Trim();                
                int fSpcId = 0;
                object oSpcId = this.dgvMain.SelectedRows[0].Cells["colMfSpcId"].Value;
                if (oSpcId != null && oSpcId.ToString().Length > 0)
                    fSpcId = Convert.ToInt32(oSpcId);
                //int fSpcId = Convert.ToInt32(this.dgvMain.SelectedRows[0].Cells["colMfSpcId"].Value.ToString().Trim());
                CurrencyManager cm = (CurrencyManager)BindingContext[dgvItem.DataSource];
                cm.SuspendBinding();

                for (int i = 0; i )
                {
                    if (dgvItem.Rows[i].Cells["colfMaterielCode"].Value.ToString().Trim().Equals(fMaterielCode) &&
                        Convert.ToInt32(dgvItem.Rows[i].Cells["colfSpcId"].Value.ToString()) == fSpcId)
                    {
                        dgvItem.Rows[i].Visible = true;
                    }
                    else
                    {
                        dgvItem.Rows[i].Visible = false;
                    }
                }
                cm.ResumeBinding();
            }
        }
 //显示/隐藏等待框
        public void ShowLoading(string strMsg)
        {
            if (strMsg.Trim() != "") //顯示
            {
                this.Cursor = Cursors.WaitCursor;
                lblLoadingMsg.Text = (strMsg.Trim() == "" ? "正在处理中" : strMsg) + ",请稍等...";
                pnlLoading.Visible = true;
                pnlLoading.BringToFront();
                Application.DoEvents();
            }
            else                //隱藏
            {
                pnlLoading.Visible = false;
                this.Cursor = Cursors.Default;
            }
        } 
 

 

.Net常用技巧_隐藏/显示DataGridView的行/等待框(转),搜素材,soscw.com

.Net常用技巧_隐藏/显示DataGridView的行/等待框(转)

标签:datagridview   style   blog   color   os   io   

原文地址:http://www.cnblogs.com/yuyuanfeng/p/3811542.html

上一篇:css概述

下一篇:HTML概述


评论


亲,登录后才可以留言!