G
Guest
Hello all,
I have a loop and would like to create a new textbox on each iteration of
the loop. The code below only generates one textbox no matter how many times
the loop loops! Any insight would be greatly appreciated.
int over = 25;
int down = 0;
for (int i = theEmail.Attachments.Count; i > 0; i--)
{
try
{
OL.Attachment attachment =theEmail.Attachments;
string fileStorage=@"c:\" +theEmail.Attachments.DisplayName;
rmaxOutlook.attachmentFormBuilder newAttachTextField=new
attachmentFormBuilder(attachment.DisplayName,fileStorage,i);
TextBox newTxtAttachField = new TextBox();
newTxtAttachField.Width = 338;
newTxtAttachField.Location = new Point(over, down + 25);
newTxtAttachField.Text = attachment.DisplayName;
this.Controls.Add(newTxtAttachField);
attachment.SaveAsFile(@"c:\" + theEmail.Attachments.DisplayName);
}
catch (Exception exc)
{
System.Windows.Forms.MessageBox.Show(exc.ToString());
}
}
I have a loop and would like to create a new textbox on each iteration of
the loop. The code below only generates one textbox no matter how many times
the loop loops! Any insight would be greatly appreciated.
int over = 25;
int down = 0;
for (int i = theEmail.Attachments.Count; i > 0; i--)
{
try
{
OL.Attachment attachment =theEmail.Attachments;
string fileStorage=@"c:\" +theEmail.Attachments.DisplayName;
rmaxOutlook.attachmentFormBuilder newAttachTextField=new
attachmentFormBuilder(attachment.DisplayName,fileStorage,i);
TextBox newTxtAttachField = new TextBox();
newTxtAttachField.Width = 338;
newTxtAttachField.Location = new Point(over, down + 25);
newTxtAttachField.Text = attachment.DisplayName;
this.Controls.Add(newTxtAttachField);
attachment.SaveAsFile(@"c:\" + theEmail.Attachments.DisplayName);
}
catch (Exception exc)
{
System.Windows.Forms.MessageBox.Show(exc.ToString());
}
}