更改datagrid列顺序或索引 [英] change datagrid columns order or index

查看:148
本文介绍了更改datagrid列顺序或索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我不能相信我无法想出的东西 - 请告诉我我错过了一些简单的东西。



我有一个datagrid ,我正在填写LINQ以及一个自定义类来添加数据。



之后,我需要一个特定顺序的数据 - 似乎忽略了我



如何更改列属性,如索引等?



这里是LINQ代码我我正在使用:



提前感谢...

  =从m在db.details _ 
其中m.InboundDate> = CType(MonthCalendar1.SelectionStart,DateTime)_
和m.InboundDate< = CType(MonthCalendar1.SelectionEnd,DateTime).AddHours( 23).AddMinutes(59)_
和m.ClientNo = 1 _
加入md在db.Manifests在md.ManifestID等于m.MainID _
选择新的GridData与{.manifestID = m.MainID,.InboundDate = m.InboundDate,.Zip = m.Zip,.LadingPkgQty = md.LadingPkgQty,.Weight = m.Weight,.Zone = m.Zone,.Fuel = 23,.LineHaul = Nothing,.Freight = Nothing,.BilledAmount = Nothing,.PackageRate = Nothing ,.LTL = Nothing}


解决方案

已解决



我不敢相信我不得不花费多少东西才能找到这个!



现在看起来Sooooo很明显(像很多的.net之后!)



Datagrid.Columns(Zone)。DisplayIndex = 0 p>



Datagrid.columns(1).DisplayIndex = 0


This is something that I cannot believe I have not been able to figure out -- please tell me I am missing something simple...

I have a datagrid, I am filling it with LINQ as well as a custom class to add data to it.

Afterwards, I need the data in a specific order - it seems to ignore me.

How do I change a columns properties, like index etc??

here is the LINQ code I am using:

thanks in advance...

 Dim query = From m In db.details _
                Where m.InboundDate >= CType(MonthCalendar1.SelectionStart, DateTime) _
                And m.InboundDate <= CType(MonthCalendar1.SelectionEnd, DateTime).AddHours(23).AddMinutes(59) _
                And m.ClientNo = 1 _
                  Join md In db.Manifests On md.ManifestID Equals m.MainID _
                Select New GridData With {.manifestID = m.MainID, .InboundDate = m.InboundDate, .Zip = m.Zip, .LadingPkgQty = md.LadingPkgQty, .Weight = m.Weight, .Zone = m.Zone, .Fuel = 23, .LineHaul = Nothing, .Freight = Nothing, .BilledAmount = Nothing, .PackageRate = Nothing, .LTL = Nothing}

解决方案

Solved

I cannot believe how much stuff I had to wade through just to find this!

It seems Sooooo obvious now (like much of .net after the fact!)

Datagrid.Columns("Zone").DisplayIndex = 0

or

Datagrid.columns(1).DisplayIndex=0

这篇关于更改datagrid列顺序或索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆