Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a numeric valuethat I move from a ListView to a string and then send in an e-mail.
The value is, say, 999999.01. The Text value is displayed as 999 999.01.
When the e-mail is received the value is shown as 999?999.01. The Question mark is actually a black diamond with a white ? inside it.

I have tried using :

Dim value2 As String =theValue.Replace(" ", ",") to replace the space with a comma.

but it does not work. Obviously what looks to be a space is not a space.

Does anyone know what the character delimiting the thousands is and how i can change it?
Posted
Updated 9-Feb-13 22:47pm
v2
Comments
Jibesh 10-Feb-13 3:20am    
may I know how you perform the double to string convert operation in you code
Darrell de Wet 10-Feb-13 4:20am    
Oops, I lied to you - it's not Dim'd as double. The variable that is dim'd as doubl is written to a ListView - then taken from the list view (see code below)

A little history on the code :
This is a Putchase Order program - line items are captured and placed in a ListView.
When the line items are complete the user saves the data and requests an authorisation (hence the email)

Private Sub SendAuthEMail()
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
Dim ds1 As New DataSet
Dim theVat As String
Dim theTotal As String
Dim theItem As String


Me.lsv_Line_Items.Focus()
For x = 0 To lsv_Line_Items.Items.Count - 1
Me.lsv_Line_Items.Items(x).Selected = True
Me.lsv_Line_Items.Items(x).Focused = True
theItem = theItem & " " & lsv_Line_Items.SelectedItems(0).SubItems(2).Text & Chr(9) 'Qty
theItem = theItem & " " & lsv_Line_Items.SelectedItems(0).SubItems(3).Text & Chr(9) 'Unit
theItem = theItem & " " & lsv_Line_Items.SelectedItems(0).SubItems(1).Text & Chr(9) 'Descr

theItem = theItem & " " & lsv_Line_Items.SelectedItems(0).SubItems(6).Text & vbCrLf 'Gross Price
Next x

mail = New MailMessage()

mail.Subject = "Purchase Order authorisation request - " & lbl_Order_Number.Text

mail.Body = "Purchase Order No : " & lbl_Order_Number.Text & vbCrLf & _
" " & " " & vbCrLf & _
"Supplier : " & cbo_Supplier.Text & vbCrLf & _
" " & " " & vbCrLf & _
"Currency : " & cbo_Currency.Text & vbCrLf & _
"Order Value - Tot : " & lbl_Sub_Total.Text & vbCrLf & _
" Vat : " & theVat & vbCrLf & _
" Grand Total : " & theTotal & vbCrLf & _
" " & " " & vbCrLf & _
"" & theItem & vbCrLf & _
" " & " " & vbCrLf & _
" System Generated E-Mail (Do not Reply)"

cn.ConnectionString = "Provider=" & cp & " Data Source=" & GlobalVariables.DBPath & GlobalVariables.DBName & ";Persist Security Info=False;"
cn.Open() 'Open the connection


Ssql = "SELECT MR_Name_Surname FROM Mail_Recipient WHERE MR_Mail_Rec = 'Purchase Order'"
da = New OleDb.OleDbDataAdapter(Ssql, cn)
da.Fill(ds, "MRecip")

cn.Close()

If ds.Tables("MRecip").Rows.Count = 0 Then
MsgBox("No Purchase Order Authorisers have been registered - Mail cannot be sent")
Exit Sub
End If

For x = 0 To ds.Tables("MRecip").Rows.Count - 1
Ssql = "SELECT HR_EMail FROM HR WHERE HR_Name_Surname = '" & ds.Tables("MRecip").Rows(x).Item(0).ToString() & "'"
da = New OleDb.OleDbDataAdapter(Ssql, cn)
da.Fill(ds1, "MRecipM")
mail.To.Add(ds1.Tables("MRecipM").Rows(0).Item(0).ToString()) 'Add mail recipient
ds1.Clear()
Next x

ds.Clear()

SmtpServer.Credentials = New Net.NetworkCredential(email address", "password") ' Senders email address and password
SmtpServer.Port = 25 'The port
SmtpServer.Host = "hostname" 'Host
mail.From = New MailAddress("email address") 'Same email address as used above (*Credentials)

SmtpServer.Send(mail)

End Sub 'SendAuthEMail()

1 solution

Try using one of
string temp = mystring.Replace("\r", "");<br />
string temp = mystring.Replace("\r\n", "");


Of course, you can always consider using Regex[^] as another option.
 
Share this answer
 
Comments
Darrell de Wet 10-Feb-13 3:16am    
Hi Abhinev

Thanks for your quick response.

Unfortunately the \r or\r\n has not worked.
My instinct, which given my level of experience with .net is not great, says that using Regex will not help because I cannot identify the character that i am trying to replace.
Any suggestions ?
Espen Harlinn 10-Feb-13 18:37pm    
Update your fonts, that is - you need to ensure that the font you are using supports the full unicode character set. The symbol you are describing is a default replacement for symbols not found in the current font.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900