A little bit of a problem (Visual C#)
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: A little bit of a problem (Visual C#)

  1. #1
    Join Date
    Apr 2009
    Posts
    1

    A little bit of a problem (Visual C#)

    Hi.

    I'm building an application where the folowing piece of code doesn't work properly:

    try
    {

    if (this.mainDataSet.Apment.Rows.Count == 0) { this.apmentTableAdapter.Fill(this.mainDataSet.Apment); }

    if (calendar.SelectionStart != null){
    this.apmentBindingSource.Filter = "ApmentDateDay = " + day;
    this.apmentBindingSource.Filter = "ApmentDateMonth = " + month;
    this.apmentBindingSource.Filter = "ApmentDateYear = " + year; }

    label1.Text = day + "-" + month + "-" + year;
    }
    catch (Exception ex)
    {
    MessageBox.Show("Error: " + ex );
    }


    It's inside a Month Calendar - SelectedDateChange(using Visual C# 2008). It's purpose is that, whenever someone select a date. I want all rows in my Apment table what are associated with that date, to show in a listbox (which is already bound to the table). And that piece of code should do it. And it does filter it out. But then after like 10 miliseconds every row come back into the listBox.

    It doesnt go to catch and show me a MessageBox, which means that the code in try IS being runned.

    Thank you all.
    -Jeppe

  2. #2
    Join Date
    Mar 2004
    Location
    Prague, Czech Republic, EU
    Posts
    1,701

    Re: A little bit of a problem (Visual C#)

    Place a breakpoint and trace the execution in debugger. At first look, you are replacingthe filter expression, so you probably has other filter set than you want.
    • Make it run.
    • Make it right.
    • Make it fast.

    Don't hesitate to rate my post.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center