Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET3.0
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 9-Feb-13 21:21pm
Edited 9-Feb-13 23:47pm
v2
Comments
jibesh at 10-Feb-13 3:20am
   
may I know how you perform the double to string convert operation in you code
Darrell de Wet at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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

 
Of course, you can always consider using Regex[^] as another option.
  Permalink  
Comments
Darrell de Wet at 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 at 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 575
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 369
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,476
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,917


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 10 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100