RepositoryItemLookUpEdit编辑列如何输入新值
答案:2 悬赏:70 手机版
解决时间 2021-03-11 00:13
- 提问者网友:爱了却不能说
- 2021-03-10 11:50
RepositoryItemLookUpEdit编辑列如何输入新值
最佳答案
- 五星知识达人网友:执傲
- 2021-03-10 12:04
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) =
'将新行加入到该类编辑器绑定的集合
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) =
'将新行加入到该类编辑器绑定的集合
全部回答
- 1楼网友:刀戟声无边
- 2021-03-10 12:23
/ 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;
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯