-
April 10th, 2009, 04:58 AM
#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
-
April 10th, 2009, 06:22 AM
#2
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|