StreamWriter text formatting issue (.RTF)

Discussion in 'Mixed Languages' started by QuantumBug, May 24, 2012.

  1. QuantumBug

    QuantumBug MDL Developer

    Mar 7, 2012
    1,488
    1,322
    60
    #1 QuantumBug, May 24, 2012
    Last edited by a moderator: Apr 20, 2017
    I've just spent an hour on DigitalPID Decryptors new updates and I've run into some trouble while manually formatting some RTF text.

    Firstly here is the problematic code, the rest has been removed.

    Code:
                MySWInfo.WriteLine("\par")
                MySWInfo.WriteLine("   \cf1 System Directory:\cf0  " + lbsysdir.Text)
                MySWInfo.WriteLine("\par")
                MySWInfo.WriteLine("\cf1 Install Date & Time:\cf0  " + lbinstalldate.Text)
    
    Where the output should show

    Code:
          Boot Device: \Device\HarddiskVolume1
     System Directory: C:\Windows\system32
    
    But it doesn't show anything past the "\" as formatting in an RTF file uses "\\" and shows as...

    Code:
          Boot Device: 
     System Directory: C:
    
    Can anyone help me here as I can't figure it out. Thanks in advance.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. QuantumBug

    QuantumBug MDL Developer

    Mar 7, 2012
    1,488
    1,322
    60
    #2 QuantumBug, May 25, 2012
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Don't worry, I fixed it with the below :D

    Code:
                MySWInfo.WriteLine("\par")
                Dim bdString As String = CStr(lbbootdev.Text)
                MySWInfo.WriteLine("        \cf1 Boot Device:\cf0  " + (bdString.Replace("\", "\\")))
                MySWInfo.WriteLine("\par")
                Dim sdString As String = CStr(lbsysdir.Text)
                MySWInfo.WriteLine("   \cf1 System Directory:\cf0  " + (sdString.Replace("\", "\\")))
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...