Articles in this section
Category / Section

How to set Hex formatting of integer cell in WinForms GridControl?

1 min read

Integer format as hex decimal

As per WinForms Grid Control architecture the hex decimal format like {0x{0:X4} cannot be assigned by using Format property. As we have used IFormattable interface to convert the format to string, the format has to be converted from String.Format method. In the below sample, HexDecimal format to the integer cell has been set using the QueryCellInfo event.

C#

this.gridControl1.QueryCellInfo += new GridQueryCellInfoEventHandler(gridControl1_QueryCellInfo);
void gridControl1_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
   if (e.ColIndex == 3 && e.RowIndex>0)
   {
       e.Style.Text = string.Format("0x{0:X4}", 255);
   }
}

 

VB

Private Me.gridControl1.QueryCellInfo += New GridQueryCellInfoEventHandler(AddressOf gridControl1_QueryCellInfo)
Private Sub gridControl1_QueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellInfoEventArgs)
   If e.ColIndex = 3 AndAlso e.RowIndex>0 Then
    e.Style.Text = String.Format("0x{0:X4}", 255)
   End If
End Sub
 

 

Shows the hexa decimal format in the grid column

Conclusion

I hope you enjoyed learning about how to set Hex formatting of integer cell in WinForms GridControl.

You can refer to our  WinForms Grid Control’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms Grid Control documentation to understand how to present and manipulate data. 

For current customers, you can check out our WinForms from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms Grid Control and other WinForms components.

If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied