DataGrid exception on U+200D in text w/ Arial Unicode MS font

Discussion in 'ASP .Net Datagrid Control' started by Pete Dembrowski, Jun 17, 2004.

  1. The DataGrid control throws the following exception:

    "An unhandled exception of type
    'System.Runtime.InteropServices.ExternalException' occurred in
    system.windows.forms.dll. Add'l information: "A generic error occurred in
    GDI+"

    This occurs when I have the 'Font' property set to the "Arial Unicode MS"
    font AND send it a string of Unicode-encoded text that contains the Zero
    Width Non Joiner character (U+200D). The following code pasted below the
    "InitializeComponent" call in a Form ctor will show the problem (of a
    default-C# Windows Application project in VS.Net 2003, where the Form has a
    DataGrid control named dataGrid1):

    +-----------------cut here -----------------+
    const string strColumn = "Column name";
    DataTable myTable = new DataTable("myTable");
    myTable.Columns.Add(new DataColumn(strColumn,typeof(string)));
    DataRow rowNew = myTable.NewRow();
    myTable.Rows.Add(rowNew);
    dataGrid1.DataSource = myTable;

    // PROBLEM STATEMENTs begin
    rowNew[strColumn] = "\x0938\x091A\x094d\x200d\x091A";
    dataGrid1.Font = new Font("Arial Unicode MS", 12);
    // PROBLEM STATEMENTs end
    +-----------------cut here -----------------+

    If you either a) remove the "\x200d" portion of the string or b) comment out
    the change of Font property (i.e. so it remains the default "Microsoft Sans
    Serif" font), then it works fine.

    Any ideas on a fix (besides using a different font?)
    Pete Dembrowski, Jun 17, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Karl Hungus

    Font class, external font files question

    Karl Hungus, Feb 4, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    517
    Karl Hungus
    Feb 4, 2004
  2. =?Utf-8?B?Tmlja3k=?=
    Replies:
    2
    Views:
    696
    Matt Berther
    Feb 20, 2005
  3. Michael Glavitsch
    Replies:
    1
    Views:
    747
    Roedy Green
    Jul 15, 2003
  4. gino
    Replies:
    3
    Views:
    3,959
    Mike Smith
    Jul 11, 2004
  5. mttc
    Replies:
    2
    Views:
    2,371
    Roedy Green
    Jul 3, 2009
Loading...

Share This Page