Hi eXtreme,
Thanks for your post.
First, do you use ListView or ListBox in your application? You mentioned
ListView in the post title, however, ListBox in the content. Currently, I
assume you use ListBox.
Normally, we can re-order the databinding with setting a sort expression in
DataView.Sort property. I have writen a little sample project for your
scenario, however, it works well for re-ordering and updating. Code snippet
listed below:
private DataTable dt=null;
private void Form1_Load(object sender, System.EventArgs e)
{
dt=new DataTable();
dt.Columns.Add(new DataColumn("column1", typeof(int)));
dt.Columns.Add(new DataColumn("column2", typeof(string)));
for(int i=0;i<6;i++)
{
DataRow dr=dt.NewRow();
dr["column1"]=i;
dr["column2"]="item"+i.ToString();
dt.Rows.Add(dr);
}
this.listBox1.DataSource=dt;
this.listBox1.DisplayMember="column2";
this.listBox1.ValueMember="column1";
}
private void button1_Click(object sender, System.EventArgs e)
{
this.dt.Rows[3]["column1"]="7";
this.dt.Rows[3]["column2"]="item7";
this.dt.DefaultView.Sort="column1 DESC";
}
===========================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights.