Hi once again I turn to You awesome people in here. :)
I'm still working on my big project and now I've noticed that it doesn't save the multiline textboxes as multiline but it saves it as a single line with all the lines text in it.
How do I fix that because I need it to store it as multiline in the cell in Access DB??
Here's the some of the code, from a save and send button, i'm using now:
Hope You can help me. :eek:
I'm still working on my big project and now I've noticed that it doesn't save the multiline textboxes as multiline but it saves it as a single line with all the lines text in it.
How do I fix that because I need it to store it as multiline in the cell in Access DB??
Here's the some of the code, from a save and send button, i'm using now:
Code:
<System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")> Private Sub ButtonSendTilCommcenFrh_Click(sender As System.Object, e As System.EventArgs) Handles ButtonSendTilCommcenFrh.Click
Dim smtpserver As New SmtpClient()
Dim mail As New MailMessage()
Dim file As System.IO.StreamWriter
If SystemComboBox.Text = "MAIL" Then
If My.Computer.FileSystem.FileExists("afgangssignal.txt") Then
Delay(1)
My.Computer.FileSystem.DeleteFile("afgangssignal.txt")
Delay(1)
GoTo LAV
Else
GoTo LAV
End If
LAV: file = My.Computer.FileSystem.OpenTextFileWriter(mfileName, True)
file.WriteLine(HeadTextBox.Text)
file.WriteLine(FActionComboBox.Text)
file.WriteLine(FInfoComboBox.Text)
file.WriteLine(DTGTextBox.Text)
file.WriteLine(KlasifikationComboBox.Text)
file.WriteLine(FMTextBox.Text)
file.WriteLine(TOTextBox.Text)
file.WriteLine(INFOTextBox.Text)
file.WriteLine(PARAATextBox.Text)
file.WriteLine(PARABTextBox.Text)
file.WriteLine(PARACTextBox.Text)
file.WriteLine(PARADTextBox.Text)
If REFTextBox.Text = "" Then
GoTo LAV2
ElseIf REFTextBox.Text = " " Then
GoTo LAV2
Else
file.WriteLine(REFTextBox.Text)
End If
LAV2: file.WriteLine(AfsenderTextBox.Text)
file.WriteLine(ModtagerTextBox.Text)
file.WriteLine(TidTextBox.Text)
file.WriteLine(SystemComboBox.Text)
file.WriteLine(UdfærdigerTextBox.Text)
file.WriteLine(GodkendtafTextBox.Text)
file.WriteLine("NNNN")
file.Close()
Dim attachment As New Attachment("afgangssignal.txt")
smtpserver.Credentials = New Net.NetworkCredential(My.Settings.uname, My.Settings.pass)
smtpserver.Host = My.Settings.server
smtpserver.Port = My.Settings.port
mail = New MailMessage
mail.From = New MailAddress(My.Settings.uname)
mail.To.Add(DatabaseDataSet.Tables("stamdata").Rows(0).Item(11))
mail.Subject = "Afgangssignal fra MHV-fartøj"
mail.Body = "Afgangssignal er vedhæftet"
mail.Attachments.Add(attachment)
Try
smtpserver.Send(mail)
Catch ex As SmtpException
MsgBox("Der er en fejl i emailindstillingerne")
End Try
Me.Validate()
Me.KommunikationsjournalBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.DatabaseKommunikationjournal)
MsgBox("Signal sendt")
Me.Close()
Else
MsgBox("Du har ikke valgt MAIL som system!")
End If
End Sub