Results 1 to 2 of 2

Thread: Unicode Font not getting updated

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2016
    Posts
    41

    Unicode Font not getting updated

    Purpose : I am combining two different language text from two different RTBs into another RTB. Language1 uses a Unicode font and Language2 uses normal font. In the process the Unicode stuff alone is an issue here. The fontsize which I set getting updated properly, whereas the fontstyle property alone not getting updated. I am using a for loop. In the very first loop everything is intact as I set. From the second loop onward alone the issue is as above.

    Summary : Everything is OK, except for the fontstyle stuff, that too when using a Unicode font.......

    Here is my code....

    Code:
    Private Sub cmdCombine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCombine.Click
            Dim Lines1() As String
            Dim Lines2() As String
            Dim CurPos As Integer = 0
            Dim vAddedText As String = ""
    
            If txtSanskrit.Text = "" Or txtNew1.Text = "" Then
                MsgBox("What to combine?", MsgBoxStyle.Exclamation)
                Exit Sub
            End If
    
            txtCombine.Text = ""
            Lines1 = Split(txtSanskrit.Text, vbLf & vbLf)
            Lines2 = Split(txtNew1.Text, vbLf & vbLf)
    
            If UBound(Lines1) <> UBound(Lines2) Then
                MsgBox("Error")
                Exit Sub
            End If
    
            For a = 0 To UBound(Lines1)
                If a = 0 Then
                    vAddedText = Lines1(a)
                Else
                    vAddedText = vbCrLf & vbCrLf & Lines1(a)
                End If
    
                txtCombine.SelectionStart = CurPos
                txtCombine.SelectionLength = Len(Lines1(a))
                txtCombine.SelectionFont = New Font("BRHDev02", 11, FontStyle.Bold) ' this is the so called unicode font
                txtCombine.AppendText(vAddedText)
                CurPos = CurPos + Len(Lines1(a)) + 2
    
                txtCombine.SelectionStart = CurPos
                txtCombine.SelectionLength = Len(Lines2(a))
                txtCombine.SelectionFont = New Font("Geethapria", 12, FontStyle.Regular)
                vAddedText = vbCrLf & Lines2(a)
                txtCombine.AppendText(vAddedText)
                CurPos = CurPos + Len(Lines2(a)) + 1
    
            Next a
    
            
        End Sub
    Last edited by ragavendran; Oct 13th, 2016 at 08:42 PM.

  2. #2
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,600

    Re: Unicode Font not getting updated

    You should test out that code(only the line you highlighted) on a normal control first. Like a Label or a TextBox. Can your code change a Label's font to that BRHDev02 font ? Lets answer that question first.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width