locked
Help with While statement RRS feed

  • Question

  • User822391386 posted

    Hi guys!

    Nobody seems to be able to help me with the following vb problem. I have 10 static text boxes called txtMail0, txtMail1, txtMail2 etc. In my databse I have a table called Emails with 2 columns, "Contact" and "Email".

    All I want to do is to read the contacts and email addresses and place them, 10 at a time in the respective text boxes to be sent as bulk email to clients. I have tried to read them into a dataset and used an while loop, but with no luck, because I can't seem to "place" the info I read into the text boxes. Can someone PLEASE help me with this urgent problem...

    Alway thankful!
     

    Thursday, April 24, 2008 7:07 AM

Answers

  • User848370396 posted

     

    Dataset dsTemp = // get the top 10 results from database, 

    for (int vLoop = 0; vLoop < 10; vLoop++)

    {

    TextBox txtMail = (TextBox)Page.FindControl("txtMail" + vLoop.ToString()); // this method will be useful to you.

    txtMail.Text = dsTemp.Tables[0].Rows[vLoop]["MailAddress"].ToString();

    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 24, 2008 8:11 AM