|
-
Apr 27th, 2009, 02:58 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Showing another forms using showdialog
Hello everyone I make a program upon sending emails to my friends using smtp. The problem is that I have confusions why my another form will not show until it is not finished sending all of the messages. I want my next form to show how many percent were finished but the problem is that my form will show only until all the emails are sent on my listbox. I put my code on the load event of the form. Am I incorrect upon viewing my form? Thanks everyone.
-
Apr 27th, 2009, 03:35 AM
#2
Re: Showing another forms using showdialog
Would you like to share your code with us? Otherwise its all just guesswork in the dark.
-
Apr 27th, 2009, 03:41 AM
#3
Hyperactive Member
Re: Showing another forms using showdialog
i think u have a function in load form which sends emails (Syn) or whatever, then u have a function or code that shows ur next form..
Its just a Guess in the DARK..
-
Apr 27th, 2009, 04:37 AM
#4
Thread Starter
Hyperactive Member
Re: Showing another forms using showdialog
This is what in my form2 load event:
Code:
Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim i As Integer
Dim j As Integer
With ListView1
For i = 0 To frmMain.ListView1.Items.Count - 1
Dim LVITem As New ListViewItem
' Create some text (= read in from data source)
LVITem.Text = frmMain.ListView1.Items(i).SubItems(0).Text '& i.ToString
' Add it to the ListView
.Items.Insert(0, LVITem)
' Add the sub items (= read in from data source)
LVITem.SubItems.Add(frmMain.ListView1.Items(i).SubItems(1).Text)
LVITem.SubItems.Add("")
Next
For j = 0 To ListView1.Items.Count - 1
holder = ListView1.Items(j).SubItems(1).Text
sendHTMLmail()
Next
End With
End Sub
And this is my sub sendHTML
Code:
Sub sendHTMLmail()
Dim iMsg As Object
Dim iConf As Object
Dim Flds As Object
Dim schema As String
Dim i As Integer
nfi.NumberDecimalDigits = 0
nfi.NumberGroupSeparator = ","
iMsg = CreateObject("CDO.Message")
iConf = CreateObject("CDO.Configuration")
Flds = iConf.Fields
schema = "http://schemas.microsoft.com/cdo/configuration/"
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpserver") = frmMain.txtSMTPServer.Text
Flds.Item(schema & "smtpserverport") = CInt(frmMain.txtSMTPPort.Text)
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "sendusername") = frmMain.txtUsername.Text
Flds.Item(schema & "sendpassword") = frmMain.txtPassword.Text
Flds.Item(schema & "smtpusessl") = 1
Flds.Update()
Try
With iMsg
.To = holder
.From = frmMain.txtFrom.Text
.Sender = frmMain.txtFromDisplayName.Text
.ReplyTo = frmMain.txtReplyTo.Text
If frmMain.txtAttachment.Text.Length = 0 Then
.Subject = frmMain.txtSubject.Text
.HTMLBody = frmMain.RichTextBox2.Text
.Organization = "Arabian Publications Inc."
.Configuration = iConf
.Send()
Else
.AddAttachment(frmMain.txtAttachment.Text)
.Subject = frmMain.txtSubject.Text
.HTMLBody = frmMain.RichTextBox2.Text
.Organization = "Arabian Publications Inc."
.Configuration = iConf
.Send()
End If
End With
iMsg = Nothing
iConf = Nothing
Flds = Nothing
For i = 0 To ListView1.Items.Count - 1
ListView1.Items(i).SubItems(2).Text = "Sent Successfully"
Next
Catch ex As Net.Mail.SmtpException
MsgBox(iMsg.GetLastErrDescription, vbOKOnly, "ANSMTP COM Object")
End Try
End Sub
the second column of my listview contains the email ids and i want to fill the next row to it if it will be successfully sent or not. Thanks everyone for the reply.
Last edited by shyguyjeff; Apr 27th, 2009 at 04:45 AM.
-
Apr 27th, 2009, 07:25 PM
#5
Re: Showing another forms using showdialog
Not sure if this applies, but if you put Form1.ShowDialog in Form1's Load Event, then it will not finish loading until you do something on Form2.
-
May 19th, 2009, 03:02 AM
#6
Thread Starter
Hyperactive Member
Re: [RESOLVED] Showing another forms using showdialog
thanks for the information everyone.. have a nice day..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|