dcsimg
Results 1 to 6 of 6

Thread: [RESOLVED] Showing another forms using showdialog

  1. #1

    Thread Starter
    Hyperactive Member shyguyjeff's Avatar
    Join Date
    Jul 2007
    Location
    City of Durian
    Posts
    289

    Resolved [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.

  2. #2
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: Showing another forms using showdialog

    Would you like to share your code with us? Otherwise its all just guesswork in the dark.

  3. #3
    Hyperactive Member
    Join Date
    Jan 2009
    Posts
    429

    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..

  4. #4

    Thread Starter
    Hyperactive Member shyguyjeff's Avatar
    Join Date
    Jul 2007
    Location
    City of Durian
    Posts
    289

    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.

  5. #5
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    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.
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  6. #6

    Thread Starter
    Hyperactive Member shyguyjeff's Avatar
    Join Date
    Jul 2007
    Location
    City of Durian
    Posts
    289

    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
  •  



Featured


Click Here to Expand Forum to Full Width