BoldDeskPremium customer service software with affordable pricing: $10 for 3 agents. Try it for free.
this.gridControl1.CurrentCellCloseDropDown += new PopupClosedEventHandler(gridControl1_CurrentCellCloseDropDown);
this.gridControl1.CurrentCellKeyDown += new KeyEventHandler(gridControl1_CurrentCellKeyDown);
private bool flag = false;
private int row, col;
void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
row = this.gridControl1.CurrentCell.RowIndex;
col = this.gridControl1.CurrentCell.ColIndex;
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.D)
{
flag = true;
this.gridControl1[row, col].CellType = "ComboBox";
this.gridControl1[row, col].ShowButtons = GridShowButtons.Hide;
StringCollection items = new StringCollection();
for (int i = 1; i < this.gridControl1.RowCount; i++)
{
if (i != row)
{
String s = this.gridControl1[i, col].Text;
if (s != null&&!s.Equals(String.Empty))
{
if (!items.Contains(s))
{
items.Add(s);
}
}
}
}
this.gridControl1[row, col].ChoiceList = items;
this.gridControl1.CurrentCell.ShowDropDown();
}
}
void gridControl1_CurrentCellCloseDropDown(object sender, PopupClosedEventArgs e)
{
if (flag == true)
{
this.gridControl1[row, col].CellType = "Standard";
flag = false;
}
}
this.gridControl1.CurrentCellCloseDropDown += new PopupClosedEventHandler(gridControl1_CurrentCellCloseDropDown);
this.gridControl1.CurrentCellKeyDown += new KeyEventHandler(gridControl1_CurrentCellKeyDown);
private bool flag = false;
private int row, col;
void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
row = this.gridControl1.CurrentCell.RowIndex;
col = this.gridControl1.CurrentCell.ColIndex;
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.D)
{
flag = true;
this.gridControl1[row, col].CellType = "ComboBox";
this.gridControl1[row, col].ShowButtons = GridShowButtons.Hide;
StringCollection items = new StringCollection();
for (int i = 1; i < this.gridControl1.RowCount; i++)
{
if (i != row)
{
String s = this.gridControl1[i, col].Text;
if (s != null&&!s.Equals(String.Empty))
{
if (!items.Contains(s))
{
items.Add(s);
}
}
}
}
this.gridControl1[row, col].ChoiceList = items;
this.gridControl1.CurrentCell.ShowDropDown();
}
}
void gridControl1_CurrentCellCloseDropDown(object sender, PopupClosedEventArgs e)
{
if (flag == true)
{
this.gridControl1[row, col].CellType = "Standard";
flag = false;
}
}
this.gridControl1.CurrentCellCloseDropDown += new PopupClosedEventHandler(gridControl1_CurrentCellCloseDropDown);
this.gridControl1.CurrentCellKeyDown += new KeyEventHandler(gridControl1_CurrentCellKeyDown);
private bool flag = false;
private int row, col;
void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
row = this.gridControl1.CurrentCell.RowIndex;
col = this.gridControl1.CurrentCell.ColIndex;
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.D)
{
flag = true;
this.gridControl1[row, col].CellType = "ComboBox";
this.gridControl1[row, col].ShowButtons = GridShowButtons.Hide;
StringCollection items = new StringCollection();
for (int i = 1; i < this.gridControl1.RowCount; i++)
{
if (i != row)
{
String s = this.gridControl1[i, col].Text;
if (s != null&&!s.Equals(String.Empty))
{
if (!items.Contains(s))
{
items.Add(s);
}
}
}
}
this.gridControl1[row, col].ChoiceList = items;
this.gridControl1.CurrentCell.ShowDropDown();
}
}
void gridControl1_CurrentCellCloseDropDown(object sender, PopupClosedEventArgs e)
{
if (flag == true)
{
this.gridControl1[row, col].CellType = "Standard";
flag = false;
}
}