/// <summary>

/// 數(shù)據(jù)源
/// </summary>
private DataTable g_dtSource = new DataTable();
#region InitGrid 初始化Grid標(biāo)題信息
/// <summary>
/// 初始化Grid標(biāo)題信息
/// </summary>
private void InitGrid()
{
this.g_dtSource.Clear();
this.g_dtSource.Columns.Add("DeviceCode", typeof(string)).ReadOnly = true;
this.g_dtSource.Columns.Add("SlotName", typeof(string)).ReadOnly = true;
this.g_dtSource.Columns.Add("MitemCode", typeof(string)).ReadOnly = true;
this.g_dtSource.Columns.Add("LoadStatus", typeof(string)).ReadOnly = true;
this.dgInfo.DataSource = this.g_dtSource;
DataGridTableStyle dgtStyle = new DataGridTableStyle();
if (this.dgInfo.TableStyles.Count == 0)
{
this.dgInfo.TableStyles.Add(dgtStyle);
dgtStyle.GridColumnStyles[0].HeaderText = "設(shè)備";
dgtStyle.GridColumnStyles[0].MappingName = "DeviceCode";
dgtStyle.GridColumnStyles[0].NullText = "";
dgtStyle.GridColumnStyles[0].Width = 50;
dgtStyle.GridColumnStyles[1].HeaderText = "棧位";
dgtStyle.GridColumnStyles[1].MappingName = "SlotName";
dgtStyle.GridColumnStyles[1].NullText = "";
dgtStyle.GridColumnStyles[1].Width = 60;
dgtStyle.GridColumnStyles[2].HeaderText = "物料編碼";
dgtStyle.GridColumnStyles[2].MappingName = "MitemCode";
dgtStyle.GridColumnStyles[2].NullText = "";
dgtStyle.GridColumnStyles[2].Width = 60;
dgtStyle.GridColumnStyles[3].HeaderText = "上料狀態(tài)";
dgtStyle.GridColumnStyles[3].MappingName = "LoadStatus";
dgtStyle.GridColumnStyles[3].NullText = "";
dgtStyle.GridColumnStyles[3].Width = 60;
}
}
#endregion
#region 選中整行
private void dgInfo_CurrentCellChanged(object sender, EventArgs e)
{
this.dgInfo.Select(this.dgInfo.CurrentRowIndex);
}
#endregion
//循環(huán)處理
for (int i = 0; i < this.g_dtSource.Rows.Count; i++)
{
if (this.g_dtSource.Rows[i]["SlotName"].ToString() == SloatName)
{
bSloatName = true;
currMitemCode = this.g_dtSource.Rows[i]["MitemCode"].ToString();
//bool bEqualMitemCode = false;
//bEqualMitemCode = this.txtMitem.Text.IndexOf(currMitemCode) > 0; 不能確認(rèn)是這樣
//當(dāng)前棧位的物料 是否 與掃描的物料的UID 一致
if (ScanMitemCode == currMitemCode)
//if (bEqualMitemCode)
{
//匹配成功修改為Y
this.g_dtSource.Columns["LoadStatus"].ReadOnly = false;
this.g_dtSource.Rows[i]["LoadStatus"] = "Y";
this.dgInfo.Select(i); //設(shè)置選中
this.txtMitem.Text = "";
this.txtSloatName.Text = "";
this.txtMitem.Focus();
}
else
{
this.txtMitem.SelectAll();
this.SetMsg("上料表的物料和料盤(pán)的物料不一致!", Color.Red);
break;
//return;
}
}
if (this.g_dtSource.Rows[i]["LoadStatus"].ToString() == "Y")
{
iFinishCnt++;
}
}
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線(xiàn),公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性?xún)r(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專(zhuān)為企業(yè)上云打造定制,能夠滿(mǎn)足用戶(hù)豐富、多元化的應(yīng)用場(chǎng)景需求。
本文標(biāo)題:datagrid使用-創(chuàng)新互聯(lián)
網(wǎng)站地址:http://chinadenli.net/article32/pgisc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、網(wǎng)站改版、網(wǎng)站建設(shè)、云服務(wù)器、品牌網(wǎng)站制作、全網(wǎng)營(yíng)銷(xiāo)推廣
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容