Display Byte[] Array in DataGrid

G

Guest

Hello,

This has probably been asked before but my searches are not coming up with
anything. I have this DataAdapter mapping a table and using a DataGrid to
display the contents. I update a varchar field - and this data shows up
fine. I have a timestamp field on the server side, and the DataGrid displays
this as "Byte[] Array". This is all happening on a Windows Form. I have an
example where in a form I use an edit field for the same data and I use a
HexToString to display the hex data in string format. Is there some way I
can do this on the DataGrid? Anyway I can access that field (which
represents data from a SQL Server) and run the data value through the
HexToString converter?

Example : if the binary is 0x000000abcd I want to display this as a string
"000000ABCD" on the DataGrid field.

Thank you
 
C

cecil

PV
Try the Parse and Format events of the binding object. Format is
called as the data is pulled from the dataset and parse is called as
the binding object is updating the dataset. You can put your
HexToString code in the Format event and use the Parse event to convert
the user input back to Hex.

Hope this helps

Cecil Howell MCSD, MCT
 
G

Guest

Hi Cecil,

Thanks for the response and sorry so late in the reply. I will look at this
and try it out. I am not familiar with handling DataGrid objects so it might
take a little while.

Paul
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top