日期:2014-05-20 浏览次数:20764 次
[code=csharp]//在搜索文本框,值发生改变时触发,进行查询,并设置信息到lvBookList中[/code]
private void txtSearchInfo_TextChanged(object sender, EventArgs e)
{
//第一个对话框
//MessageBox.Show("事件触发");
this.lvBookList.Items.Clear();
DataView searchBookInfoView = txtTitleChangeBLL.getBookInfoDataSource(this.txtSearchInfo.Text);
//第二个对话框
MessageBox.Show(searchBookInfoView.Count.ToString());
int length = searchBookInfoView.Count;
//在ListView控件中添加的信息
for (int i = 0; i < length; i++)
{
this.lvBookList.Items.Add(searchBookInfoView[i][1].ToString(), i);//图书编号
this.lvBookList.Items[i].SubItems.Add(searchBookInfoView[i][0].ToString());
this.lvBookList.Items[i].SubItems.Add(searchBookInfoView[i][2].ToString());
this.lvBookList.Items[i].SubItems.Add(searchBookInfoView[i][3].ToString());
this.lvBookList.Items[i].SubItems.Add(searchBookInfoView[i][4].ToString());
}
}