0

I might be asking this all wrong and I will try my best to explain my question here. I have a query that populates a number of different GUI features. One of them being a label.

foreach (DataRow row in dt.Rows)
{
    if (row["NT"].ToString() == "C")
    {
        conSpell.Text = row["full_name_nd_ro"].ToString();
    }
}

I am able to get the value from the query into the label...Except, when there is no value in the query, the label remains populated with the old value on multiple executions.

I'm not really sure how to approach this. Any help is greatly appreciated!

Cheers Chris

1 Answer 1

1

You don't have any logic that clears the label out.

Just add this code to clear the label:

if (dt.Rows.Count == 0)
    conSpell.Text = string.Empty;

foreach( ... your code )
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.