开发者

Editable Column headers for WinForms DataGrid Control?

开发者 https://www.devze.com 2023-01-10 06:40 出处:网络
I\'d like t开发者_JS百科o display a DataGrid control where the column headers are editable by the user. Is this possible?Even though the default DataGrid doesn\'t provide the functionality, the workar

I'd like t开发者_JS百科o display a DataGrid control where the column headers are editable by the user. Is this possible?


Even though the default DataGrid doesn't provide the functionality, the workaround I used for this was to trap the click event of the column header and then use the InputBox() method to capture the new column header.

The InputBox was prepopulated with the default column header and then post validating the input string, i would update the header.

Please note, I am proposing a workaround to get the functionality baked in.

The InputBox() is located in the Microsoft.VisualBasic.dll and can be accessed as follows:

Microsoft.VisualBasic.Interaction.InputBox()

with the following signature

InputBox(prompt[, title] [, default] [, xpos] [, ypos] [, helpfile, context])

Hope it helps!

0

精彩评论

暂无评论...
验证码 换一张
取 消