rosshodges
Active member
- Joined
- Nov 23, 2002
- Messages
- 28
I am trying to make my menu about button take me to another form. I added the code but it says its a non-shared memeber and requires an object reference? any ideas?
Private Sub butSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butSend.Click
Dim bSuccess As Boolean = False
Dim oFiles As New Collection()
Dim sFileNames() As String
Dim byArray() As Byte
Dim i As Integer
Dim fs As FileStream
Dim oSMTP As New SMTPMailer.CSMTP()
Dim about As New Form()
butSend.Enabled = False
If lstFiles.Items.Count <> 0 Then
ReDim sFileNames(lstFiles.Items.Count - 1)
For i = 0 To lstFiles.Items.Count - 1
sFileNames(i) = Path.GetFileName(lstFiles.Items(i).ToString).ToString
fs = New System.IO.FileStream(lstFiles.Items(i).ToString, System.IO.FileMode.Open, System.IO.FileAccess.Read)
ReDim byArray(CInt(fs.Length))
fs.Read(byArray, 0, CInt(fs.Length))
oFiles.Add(byArray, sFileNames(i))
Next
bSuccess = oSMTP.Mail(txtTo.Text, txtFrom.Text, txtSubject.Text, txtBody.Text, txtServer.Text, oFiles, sFileNames)
Else
bSuccess = oSMTP.Mail(txtTo.Text, txtFrom.Text, txtSubject.Text, txtBody.Text, txtServer.Text)
End If
oSMTP = Nothing
fs = Nothing
oFiles = Nothing
butSend.Enabled = True
End Sub
Private Sub butBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butBrowse.Click
dlgOpen.ShowDialog()
txtFileName.Text = dlgOpen.FileName
End Sub
Private Sub ExitApp()
Dim ChildForm As Form() = Me.MdiChildren
Make sure to ask for saving the doc before exiting the app
Dim i As Integer
For i = 0 To ChildForm.Length - 1
ChildForm(i).Close()
Next i
Application.Exit()
End Sub Exit
Private Sub butAddFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butAddFile.Click
lstFiles.Items.Add(txtFileName.Text)
End Sub
Private Sub butRemoveFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butRemoveFile.Click
lstFiles.Items.Remove(lstFiles.SelectedItem)
End Sub
Private Sub dlgOpen_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles dlgOpen.FileOk
End Sub
Private Sub about_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub txtServer_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub frmMailTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub txtServer_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtServer.SelectedIndexChanged
End Sub
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
End Sub
Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
dlgOpen.ShowDialog()
txtFileName.Text = dlgOpen.FileName
End Sub
Private Sub StatusBar1_PanelClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.StatusBarPanelClickEventArgs) Handles StatusBar1inactive.PanelClick
End Sub
Private Sub Label8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub txtBody_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBody.TextChanged
End Sub
Private Sub MenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem4.Click
ExitApp()
End Sub
Private Sub MenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem5.Click
Form.Show()
End Sub
End Class
Private Sub butSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butSend.Click
Dim bSuccess As Boolean = False
Dim oFiles As New Collection()
Dim sFileNames() As String
Dim byArray() As Byte
Dim i As Integer
Dim fs As FileStream
Dim oSMTP As New SMTPMailer.CSMTP()
Dim about As New Form()
butSend.Enabled = False
If lstFiles.Items.Count <> 0 Then
ReDim sFileNames(lstFiles.Items.Count - 1)
For i = 0 To lstFiles.Items.Count - 1
sFileNames(i) = Path.GetFileName(lstFiles.Items(i).ToString).ToString
fs = New System.IO.FileStream(lstFiles.Items(i).ToString, System.IO.FileMode.Open, System.IO.FileAccess.Read)
ReDim byArray(CInt(fs.Length))
fs.Read(byArray, 0, CInt(fs.Length))
oFiles.Add(byArray, sFileNames(i))
Next
bSuccess = oSMTP.Mail(txtTo.Text, txtFrom.Text, txtSubject.Text, txtBody.Text, txtServer.Text, oFiles, sFileNames)
Else
bSuccess = oSMTP.Mail(txtTo.Text, txtFrom.Text, txtSubject.Text, txtBody.Text, txtServer.Text)
End If
oSMTP = Nothing
fs = Nothing
oFiles = Nothing
butSend.Enabled = True
End Sub
Private Sub butBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butBrowse.Click
dlgOpen.ShowDialog()
txtFileName.Text = dlgOpen.FileName
End Sub
Private Sub ExitApp()
Dim ChildForm As Form() = Me.MdiChildren
Make sure to ask for saving the doc before exiting the app
Dim i As Integer
For i = 0 To ChildForm.Length - 1
ChildForm(i).Close()
Next i
Application.Exit()
End Sub Exit
Private Sub butAddFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butAddFile.Click
lstFiles.Items.Add(txtFileName.Text)
End Sub
Private Sub butRemoveFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butRemoveFile.Click
lstFiles.Items.Remove(lstFiles.SelectedItem)
End Sub
Private Sub dlgOpen_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles dlgOpen.FileOk
End Sub
Private Sub about_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub txtServer_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub frmMailTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub txtServer_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtServer.SelectedIndexChanged
End Sub
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
End Sub
Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
dlgOpen.ShowDialog()
txtFileName.Text = dlgOpen.FileName
End Sub
Private Sub StatusBar1_PanelClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.StatusBarPanelClickEventArgs) Handles StatusBar1inactive.PanelClick
End Sub
Private Sub Label8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub txtBody_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBody.TextChanged
End Sub
Private Sub MenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem4.Click
ExitApp()
End Sub
Private Sub MenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem5.Click
Form.Show()
End Sub
End Class