I made another app and I could not reproduce the error.
Life is good.. Thanks.
""Jeffrey Tan[MSFT]"" <jetan@online.microsoft.com> wrote in message
news:WKZIl$GvHHA.3972@TK2MSFTNGHUB02.phx.gbl...
> Hi,
>
> Is it possible for you to create a little sample project without the
> database dependency to help us reproduce this problem? This will be more
> efficient for us to find out the root cause.
>
> Have you setup the ListBox.DisplayMember and ListBox.ValueMember
properties
> correctly? Normally, you should set these 2 properties to the correct
> column name to tell ListBox how to bind. Actually, the following code
> snippet works well on my side:
>
> DataTable dt;
> private void Form1_Load(object sender, 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 < 5; 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, EventArgs e)
> {
> DataRow newRow = dt.NewRow();
> newRow["column2"] = "test";
> dt.Rows.Add(newRow);
> }
> You may compare my sample logic with your application logic to see what is
> the difference. Please feel free to let me know your finding.
>
> I will wait for your further feedback. Thanks.
>
> Best regards,
> Jeffrey Tan
> Microsoft Online Community Support
> ==================================================
> Get notification to my posts through email? Please refer to
>
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif > ications.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
>
http://msdn.microsoft.com/subscriptions/support/default.aspx. > ==================================================
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>