简体   繁体   中英

DataGridView reorder columns when filled with data

In a VS2010 program, I have a DataGridView with custom Columns ( not editables ). When I start the GUI, columns are shown in the order I put them; the problem is that when the program starts filling them, columns are reordered in some strange way, and I can't figure out why ( i disable the manual reordering and resizing option). How can I force the columns to stay in the order I've decided?

if AutoGenerateColumns is set to true put it to false in the properties of your DataGridView. How does it work then?

尝试仅按升序设置Grid Columns DisplayIndex属性,即1,2,3,4等。如果您的网格包含可见和不可见列,则还必须为不可见列设置网格DisplayIndex。

检查您的DTG是否正在自动创建列。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM