dataGridView显示为重复的多行问题如何解决
发布网友
发布时间:2022-04-27 14:58
我来回答
共1个回答
热心网友
时间:2022-04-27 16:27
按你的方法写,代码要循环8次,自然显示为重复行。
代码要这样写:
Structure Result
Public GeneralAntislip As Single
Public GeneralAntioverturning As Single
Public ImpactAntislip As Single
Public ImpactAntioverturning As Single
Public SeismicAntislip As Single
Public seismicAntioverning As Single
Public sigmamax As Single
Public sigmamin As Single
End Structure
Dim results(0) As Result
results(0).GeneralAntislip = SF(0)
results(0).GeneralAntioverturning = SF(1)
results(0).ImpactAntislip = SF(2)
results(0).ImpactAntioverturning = SF(3)
results(0).SeismicAntislip = SF(4)
results(0).seismicAntioverning = SF(5)
results(0).sigmamax = SF(6)
results(0).sigmamin = SF(7)
Dim query = From i In results
Let GeneralAntislip = i.GeneralAntislip
Let GeneralAntioverning = i.GeneralAntioverturning
Let ImpactAntislip = i.ImpactAntislip
Let ImpactAntioverning = i.ImpactAntioverturning
Let SeismicAntislip = i.SeismicAntislip
Let SeismicAntioverning = i.seismicAntioverning
Let sigmaMax = i.sigmamax
Let sigmamiin = i.sigmamin
Select GeneralAntislip, GeneralAntioverning,
ImpactAntislip, ImpactAntioverning,
SeismicAntislip, SeismicAntioverning,
sigmaMax, sigmamin
dgvResults.DataSource = query.ToList
dgvResults.CurrentCell = Nothing
当然你如何有数据库的知识,先转换为datase在放入Dategridview代码相对简洁。