You are absolutely right, but I had to get it working first. I moved the
buttonHelp.Click += new System.EventHandler(buttonHelp_Click);
to the textBox.enter delegate and modified the textBox.leave to:
textBox.Leave += delegate(object sender, EventArgs eventArgs)
Control pToRemove = ((TextBox)sender).Parent;
((TextBox)sender).BackColor = Color.White;
buttonHelp.Click -= new System.EventHandler(this.buttonHelp_Click);
Return focus to the control is handled in the buttonHelp.Click event handler. But there is still the question why placing a call to Control_Settings in the Form.resize event, that is never fired, makes the helpbutton control appear three times??
Based on what you've posted so far, there is no exception possible. But, since we can't see the code that declared these types, the details collection, how it's populated, ..., we really couldn't tell you for sure.
But, if the Select returns no ID's, the array will come back empty and the foreach iterating over it won't do anything.
You don't have to change this code at all.
Next time, you might want to try testing the code with test data specifically designed to try and break it.
string PkgIDs = rData.details.Where(c => c.batch_id == batchID).Select(c => c.Package_ID).Distinct().ToArray();
if(PkgIDs.Count > 0)//This will check the number of elements in the List
foreach (string PkgID in PkgIDs)
In C#, How To Send A Hyperlink Using Query String Method.
I have developing a web application of user enter enters the personal data. That information has sent to admin mail with approve/reject link button.
When the Admin click the approve link, it has approve.aspx page with the user id as query string to update the db as approved. otherwise rejected.
I can try the following code.
mail.Subject = "New User";
mail.Body = "<p>Dear Sir, <br><br> " + txtfname.Text + " " + txtlname.Text + ", has raised a requisition that needs your approval. <br><br><br> Please click to [<ahref='http://localhost:1240/IMA/Approve.aspx?id="+tt+"'> Approve</a> ] [<ahref='Reject.aspx'>Reject</a> ] the request. <br><br><br><b>Note</b> : Please do not reply. This e-mail has been auto-generated.</p>";
mail.IsBodyHtml = true;
In the mail i have move the mouse over the approve link it shows http://.../approve.aspx?id=1, but click the appove link it shows <a href="http://.../id=1.
For a C# 2010 application, I need to check for the values in a column being all spaces. The number of space characters in a field can change. Thus can you tell me how to tell if a field in a string and/or a datadbase column is all spaces?