LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

retrieve unicode text from .net control

Solved!
Go to solution

Hi all,

 

I have created a .net datagridview control in my labview application using .net container. The user can enter text in the columns and when I read the new value of the cell using the cellvaluechanged event, it all works well. But, when the user enters the text which is not ASCII(korean text in my case), the cellvaluechanged event returns questions marks("?") instead of the unicode text.

 

I am using win 7 64-bit and LV 2014 64-bit. I have set the language settings on my Windows to korean and in labview.ini I have added the line UseUnicode=True.

 

Does anyone know how to resolve this issue?

 

0 Kudos
Message 1 of 6
(4,230 Views)

@LVCoder wrote:

Hi all,

 

I have created a .net datagridview control in my labview application using .net container. The user can enter text in the columns and when I read the new value of the cell using the cellvaluechanged event, it all works well. But, when the user enters the text which is not ASCII(korean text in my case), the cellvaluechanged event returns questions marks("?") instead of the unicode text.

 

I am using win 7 64-bit and LV 2014 64-bit. I have set the language settings on my Windows to korean and in labview.ini I have added the line UseUnicode=True.

 

Does anyone know how to resolve this issue?

 


There is a reason why Unicode on LabVIEW isn't officially supported.  It's a nightmare that can spill over even onto your non-Unicode projects if you are not careful!  Be careful when summoning the Unicode demon.

 

In the meantime, do a Google on "LabVIEW Unicode" and download the toolkit.  It makes use of properties not exposed to the user, even with Unicode enabled.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 6
(4,222 Views)

I downloaded the unicode tool but I don't understand how to use it because the data returned by the data grid view itself doesn't have any unicode text. The data returned is just question marks. I have attached the sample code here to demonstrate my issue.

 

Eveytime the data in the data grid view is changed, the string control shows the data returned by DGV.

0 Kudos
Message 3 of 6
(4,211 Views)

The place where you got the toolkit has very detailed instructions on how to make it work.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 6
(4,206 Views)
Solution
Accepted by LVCoder

The following code works for one language as long as you set your Windows System Locale corectly, in your case to Korean.

 

The string returned from the DGV is DBCS. The ASCII to Unicode function converts DBCS to Unicode using the Windows MultiByteToWideChar function. You can then display the Unicode string on a LV control.

 

 

Clipboard02.png

 

 

authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX


  
0 Kudos
Message 5 of 6
(4,112 Views)

Thanks Christian!

 

Changing the Windows System Locale to Korean solved the issue. 🙂

0 Kudos
Message 6 of 6
(4,101 Views)