dataGridView1_SelectionChanged事件有问题 [英] probleme with dataGridView1_SelectionChanged event
本文介绍了dataGridView1_SelectionChanged事件有问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
这是我的第一个问题,请问如果我有语法错误
我对此事件有疑问,有时不会发生此事件,例如我为按钮编写了以下行代码:
Hi guys ,
This is my first question, excuse me if i have grammatical error
I have a problem with this event , sometimes this event doesn''t occur , example i write this line code for a button:
dataGridView1.Rows[min_index].Selected = true;
dataGridView1.FirstDisplayedScrollingRowIndex = min_index;
选择min_index
行,但selectionchanged
事件不起作用,有时搜索结果有一个结果,此事件不再发生
感谢
min_index
row be selected but selectionchanged
event doesn''t work and sometimes that search result has one result this event doesn''t occur again
thanks
推荐答案
是,谢谢您的回答
当使用鼠标笔划选择时,此事件正常工作,但是当我们想跳到特殊行时不起作用,有时在搜索结果中会发生,有时却不会发生
这是我在selectionchange事件中的代码
yes , thank you for answer
this event work properly when with mouse chenge selection but when we want jump to special row it doesn''t work , sometimes in search result it happens andsometimes itsn''t happen
this is my code in selectionchange event
try
{
stu_id = Convert.ToInt64(dataGridView1.CurrentRow.Cells[13].Value);
schoolin_id = Convert.ToInt64(dataGridView1.CurrentRow.Cells[14].Value);
Class = Convert.ToInt32(dataGridView1.CurrentRow.Cells[15].Value);
IList<students> s = new List<students>();
s = D_Students.Search_stu_id(stu_id);
txt_name.Text = s[0].NAME;
txt_family.Text = s[0].FAMILY;
txt_f_name.Text = s[0].FATHER_NAME;
IList<schooling_sign> sd = new List<schooling_sign>();
sd = D_Schooling_Sign.Select_Year(schoolin_id);
txt_schooling.Text = sd[0].YEAR;
txt_class.Text = class_schooling.number_to_schooling(Class);
button2.Enabled = true;
}
catch (Exception) { }
</schooling_sign></schooling_sign></students></students>
第3行表示排除所选行而不是当前所选行
谢谢
3 first line indicate to previose selected row not current selected row
thanks
这篇关于dataGridView1_SelectionChanged事件有问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文