0

The executable file has been created, and then run on Windows 2008 Server and Windows 2016 Server but the symbols are not rendering on Windows 2008 Server. Could you please help me to fix the issue?

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        TextBox1.Text = "⑈" + "1234"
        Me.TextBox1.AutoSize = False
        Me.TextBox1.Height = 26
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TextBox2.Text="⑆" + "5678"
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        '"files.encoding": "windows1252"
        TextBox3.Text = "⑇" + "9876"
    End Sub
End Class

enter image description here

Andrew Morton
  • 24,203
  • 9
  • 60
  • 84
Mahi
  • 11
  • 1

1 Answers1

0

What are standard unicode fonts? implies that you would have to set the font of the textboxes to Lucida Sans Unicode on the Server 2008 machine to see those glyphs.

Something like this:

Private Function IsOldOS() As Boolean
    ' Regard Windows 7 and Windows Server 2008 (and earlier) as old operating systems.
    ' See https://stackoverflow.com/questions/2819934/detect-windows-version-in-net
    Return Environment.OSVersion.Version.Major < 6 OrElse (Environment.OSVersion.Version.Major = 6 AndAlso Environment.OSVersion.Version.Minor <= 1)
End Function

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    If IsOldOS() Then
        ' Use the Unicode font available on older machines.
        ' See https://stackoverflow.com/questions/9360394/what-are-standard-unicode-fonts
        Dim fnt = New System.Drawing.Font("Lucida Sans Unicode", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        For Each tb In {TextBox1, TextBox2, TextBox3}
            tb.Font = fnt
        Next
    End If

End Sub

You may have to adjust the size of the font if you need to avoid the textboxes changing size. You might want to change the font of all the controls to keep it looking consistent.

Andrew Morton
  • 24,203
  • 9
  • 60
  • 84
  • Thanks a lot, Andrew for a quick response. one more want to clarify for windows server 2016, there symbols rendering small when compare to digits how can I resolve this one for windows 2016 servers? – Mahi Jul 03 '20 at 12:02
  • @Mahi Perhaps you could find a different (Unicode) font where the symbols you want are a better size compared to the digits. Otherwise, maybe you could use a [RichTextBox Control](https://learn.microsoft.com/en-us/dotnet/framework/winforms/controls/richtextbox-control-overview-windows-forms) instead of a TextBox, and set the font size for the symbols to be larger than the font size of the digits - that would need some investigation by you. – Andrew Morton Jul 03 '20 at 12:26
  • we are using "Arial Unicode ms" inside code, what is the best option rather than this one for windows 2016 servers, do we need follow any instructions when we migrated from windows 2008 server to windows 2016 servers for VB.net code? – Mahi Jul 03 '20 at 12:38
  • @Mahi It would be best for *you* to look through the available fonts and select a good one ;) – Andrew Morton Jul 03 '20 at 12:40
  • one more how can I increase MICR font size alone when compare to digits? – Mahi Jul 03 '20 at 12:44
  • @Mahi That should probably be a separate question, but.. start a new Windows Forms project. Put a RichTextBox on it. In the form's Load event handler, add `RichTextBox1.Text = "ABC"` `RichTextBox1.Select(0, 1)` `RichTextBox1.SelectionFont = New Font("Arial", 12.0!)` and see what happens when you run it. – Andrew Morton Jul 03 '20 at 14:28