2 Replies - 1716 Views - Last Post: 07 July 2015 - 03:32 AM

#1 xxgixxx  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 22
  • Joined: 26-October 14

Need help with progress bar in windows forms

Posted 04 April 2015 - 07:28 AM

i am new to windows forms, and i was making an application to send emails from it.

i want my progress bar to be filling while email is being sent.

i don 't know if this is possible so i asked this question here.

here is my email sender code:

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
				 ///start progress bar timer

				 MailMessage^ mail = gcnew MailMessage (textBox_FROM->Text, textBox_TO->Text, textBox_SUBJECT->Text, richTextBox_BODY->Text);
				 
				 SmtpClient^ client = gcnew SmtpClient (textBox_SMTP->Text);
				 client->Port = 587;
				 client->Credentials = gcnew System::Net::NetworkCredential(textBox_USERNAME->Text, textBox_PASSWORD->Text);
				 client->EnableSsl = true;
				 client->Send(mail);

				 MessageBox::Show ("Mail Sent", "Success", MessageBoxButtons::OK);
			 }



can i make a progress bar to fill while email is being sent and to be completely filled when email will be sent?
if yes, how, and wich commands can i use.

Is This A Good Question/Topic? 0
  • +

Replies To: Need help with progress bar in windows forms

#2 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 5786
  • View blog
  • Posts: 19,694
  • Joined: 05-May 12

Re: Need help with progress bar in windows forms

Posted 23 June 2015 - 07:04 AM

Unfortunately, the SmtpClient class does not have any real progress events for you to hook into to update a progress bar. You could put up a progress bar that does the marquee style progress, but that would be about it.
Was This Post Helpful? 0
  • +
  • -

#3 zinist  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 18
  • Joined: 25-June 15

Re: Need help with progress bar in windows forms

Posted 07 July 2015 - 03:32 AM

Hi,
You can use BackGround Worker
visit following link it will give you some idea
http://stackoverflow...n-sending-email
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1