We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get Column + Row header index

Thread ID:

Created:

Updated:

Platform:

Replies:

76146 Aug 25,2008 01:01 PM UTC Aug 27,2008 01:04 AM UTC WinForms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 25, 2008 01:01 PM UTC

Hello All:

How can I get column header index(A,B,C...) + row header index(1,2,3)

like
we give GridControl(1,1) and get "A1"
we give GridControl(1,2) and get "B1"
...

Think for any help.

Best Regards

Quenton


Sri Rajan [Syncfusion]
Replied On August 26, 2008 06:52 AM UTC

Hi Quenton,

Thank you for your interest in Syncfusion products.

Please try this code to get "A1" for the cell (1,1) and let me know if this helps.

Console.WriteLine(GridRangeInfo.GetAlphaLabel(1)+GridRangeInfo.GetNumericLabel(1));


Note:
GridRangeInfo.GetAlphaLabel(Column Index) - Returns a string in the format "A, B, C,....AA, AB,...." to be used for column labels.
GridRangeInfo.GetNumericLabel(Row Index) - Returns a numeric string in the format to be used for row labels.

Best Regards,
Srirajan.



Administrator [Syncfusion]
Replied On August 26, 2008 07:16 AM UTC

Hi Srirajan :

Thank for your reply,it's very helpful.

Best Regards

Quenton


Administrator [Syncfusion]
Replied On August 26, 2008 07:28 AM UTC

Hi Srirajan:

By the way . How can I reverse it?

like
give A1 and get row index = 1 , col index = 1
give B1 and get row index = 1 , col index = 2

Best Regards

Quenton


Sri Rajan [Syncfusion]
Replied On August 26, 2008 10:20 AM UTC

Hi Quenton,

Thank you for your interest in Syncfusion products.

Here is the code to get the row and column index from a cell reference(Example:"A1").

GridFormulaEngine engine=new GridFormulaEngine(this.gridControl1.Model);
Console.WriteLine("RowIndex : " + engine.RowIndex("A1") + " , ColIndex : " + engine.ColIndex("A1"));


Note:
engine.RowIndex(string s) - Returns a row index from a cell reference.
engine.ColIndex(string s) - Returns a column index from a cell reference.

Please let me know if this helps.

Best Regards,
Srirajan.


Administrator [Syncfusion]
Replied On August 27, 2008 01:04 AM UTC

Hi Srirajan :

Thank for your reply again,it's very helpful.

Best Regards,
Quenton.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;