RepositoryItemLookUpEdit编辑列如何输入新值
2个回答
展开全部
/ solution 1
private void LookUpEdit1_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e) {
DataRow Row;
RepositoryItemLookUpEdit Edit;
Edit = ((LookUpEdit)sender).Properties;
if(e.DisplayValue == null || Edit.NullText.Equals(e.DisplayValue) || string.Empty.Equals(e.DisplayValue))
return;
Row = LookupTable.NewRow();
Row["Name"] = e.DisplayValue;
LookupTable.Rows.Add(Row);
e.Handled = true;
}
// solution 2
private void LookUpEdit1_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e) {
DataRow Row;
RepositoryItemLookUpEdit Edit;
Edit = ((LookUpEdit)sender).Properties;
if(e.DisplayValue == null || Edit.NullText.Equals(e.DisplayValue) || string.Empty.Equals(e.DisplayValue))
return;
using(Form2 f = new Form2()) {
f.ItemID = "(Auto Number)";
f.ItemName = e.DisplayValue.ToString();
if(f.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) {
e.DisplayValue = f.ItemName;
Row = LookupTable.NewRow();
Row["Name"] = f.ItemName;
LookupTable.Rows.Add(Row);
}
}
e.Handled = true;
}
private void LookUpEdit1_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e) {
DataRow Row;
RepositoryItemLookUpEdit Edit;
Edit = ((LookUpEdit)sender).Properties;
if(e.DisplayValue == null || Edit.NullText.Equals(e.DisplayValue) || string.Empty.Equals(e.DisplayValue))
return;
Row = LookupTable.NewRow();
Row["Name"] = e.DisplayValue;
LookupTable.Rows.Add(Row);
e.Handled = true;
}
// solution 2
private void LookUpEdit1_ProcessNewValue(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e) {
DataRow Row;
RepositoryItemLookUpEdit Edit;
Edit = ((LookUpEdit)sender).Properties;
if(e.DisplayValue == null || Edit.NullText.Equals(e.DisplayValue) || string.Empty.Equals(e.DisplayValue))
return;
using(Form2 f = new Form2()) {
f.ItemID = "(Auto Number)";
f.ItemName = e.DisplayValue.ToString();
if(f.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) {
e.DisplayValue = f.ItemName;
Row = LookupTable.NewRow();
Row["Name"] = f.ItemName;
LookupTable.Rows.Add(Row);
}
}
e.Handled = true;
}
展开全部
1.在RunDesiger的Repository内置编辑器设置ProcessNewValue事件2.
Private Sub RepositoryItemLookUpEdit1_ProcessNewValue(ByVal sender As System.Object, ByVal e As DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs) Handles RepositoryItemLookUpEdit5.ProcessNewValue
Dim Row As DataRow
'添加新(空)行
Row = CType(RepositoryItemLookUpEdit1.Properties.DataSource, DataTable).NewRow()
'给新行各列赋值
Row(DESCRIPTION) = e.DisplayValue.ToString().Trim()
Row(PARTNO) =
'将新行加入到该类编辑器绑定的集合
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询