简体   繁体   English

C#DataGridView中的自动完成文本框

[英]Auto complete text box in c# datagridview

I have a data-gird view, and its first cell is student register no. 我有一个数据网格视图,它的第一个单元格是学生注册号。 and the cell is auto complete text box.When we focus on any of the data in auto compete text box then corresponding data shown in next cell. 当我们关注自动竞争文本框中的任何数据时,相应的数据将显示在下一个单元格中。 How can I do it? 我该怎么做? Which event is used? 使用哪个事件? My first cell is already an auto complete cell. 我的第一个单元格已经是一个自动完成的单元格。 My requirement is, the auto complete text box contains number of data. 我的要求是,自动完成文本框包含许多数据。 when cursor move upward or downward in the auto complete text box(here register.no) the next cell automatically shown student name. 当光标在自动完成文本框(此处为register.no)中向上或向下移动时,下一个单元格将自动显示学生姓名。 For this which event is used? 为此使用哪个事件?

try this 尝试这个

 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
    if (dataGridView1.CurrentCell.ColumnIndex.Equals(3) && e.RowIndex != -1)
    {
        if (dataGridView1.CurrentCell != null && dataGridView1.CurrentCell.Value != null)
        {
            dataGridView1[1,(dataGridView1.CurrentCell.ColumnIndex + 1)].Value ="Your Value"
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM