0

我以前从未真正使用过 Farpoint Spread,但我有一个现有的 VB.NET 应用程序,我需要在其中向 Spread 网格添加一列。目前有一些代码,如:

For Each dr As DataRow In g_AdoRS.Rows
    vaSpreadSum.SetText(1, x, dr(0))    'pol_ser
    ...
    vaSpreadSum.SetText(20, x, dr(19))    'renew_pay_cd     
    vaSpreadSum.SetFloat(21, x, dr(20))    'renew_tot_prem
    vaSpreadSum.SetFloat(22, x, dr(21))    'renew_pol_limit
    vaSpreadSum.SetFloat(23, x, dr(22))    'renew_ded_amt

    vaSpreadSum.Col = 28
    x = x + 1
Next dr

这些 SetFloat() 和 SetText() 调用从 0 到 28。所以为了添加另一列,我添加了这行代码:

vaSpreadSum.SetText(28, x, dr(27))    'agent name

并将 vaSpreadSum.Col 更改为 29

vaSpreadSum.Col = 29

但我没有在我的网格中看到另一列。知道为什么吗?没有抛出错误或类似的东西,只是屏幕上没有变化。我知道可能需要更多信息来解决这个问题,但即使有人知道将列添加到 Farpoint Spread 网格的基础知识,我也会非常感激。我发现了这一点,但我的应用程序似乎没有以这种方式添加列,我在任何地方都找不到对 AddColumns() 方法的任何调用。

谢谢你的帮助!

我相信这是我的 Form_Load 方法

Private Sub FrmDetailRPC_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
    Cursor.Current = Cursors.WaitCursor

    FormInit()
    QryLocation()

    Cursor.Current = Cursors.Default
End Sub

我还将包括 FormInit() 因为这听起来可能与我正在寻找的内容有关

Sub FormInit()
    txtBusUnit.Text = svBusUnit
    stmtMktSeg()
    txtProduct.Text = svProduct
    txtSource.Text = svSource
    txtSystem.Text = svSystem
    txtCustSeg.Text = svCustSeg

    stmtProduct()

    txtLocation.Text = svLocation
    If svLocationLabel = "Region" Then
        lblLocation.Text = "Territory"
    Else
        lblLocation.Text = svLocationLabel
    End If

    lblLocation.TextAlign = ContentAlignment.TopRight

    stmtLocation()
    'txtPayType.Text = svPayType
    txtTimePer.Text = TimeName
    stmtTimePer()

End Sub

和 QryLocation()

Sub QryLocation()
    Dim producerID As String

    'SetProductSelection()
    stmtLocation()
    stmtGetProductType()
    stmtGetTimePeriodType()
    stmtGetTimePeriod()
    stmtGetProducerID()
    stmtGetProducerType()

    If stmtProducerType = "No Preference" Then
        producerID = "NULL"
    Else
        producerID = "'" & stmtProducerID & "'"
    End If

    g_strSQL = "pc_mis_rpc_getdata_detail " & _
    "'" & stmtLocationType & "'," & _
    "'" & Trim(svLocation) & "'," & _
    "'" & svBusUnit & "'," & _
    "'" & stmtProductType & "'," & _
    "'" & Trim(stmtProductDtl) & "'," & _
    "'" & stmtTimePeriod & "'," & _
    "'" & stmtTimePeriodType & "'," & _
    "'" & stmtProducerType & "'," & _
    producerID & "," & _
    "'Retention'" _
    & FilterQry & "," & _
    "'" & Trim(txtCustSeg.Text) & "'," & _
    "'" & Trim(txtSource.Text) & "'," & _
    "'" & Trim(txtSystem.Text) & "'"


    ProcQry()

End Sub
4

2 回答 2

0

您按如下方式增加列:vaSpreadSum.MaxCols = 29

于 2014-06-11T13:48:21.920 回答
0

在您的Form_Init()情况下,您将需要调整传播控制中的列数。

它应该看起来像这样:

Sub FormInit()
    ' Add a column to the spreadsheet control
    vaSpreadSum.ActiveSheet.AddColumns(29, 1)

    ' Code cut for brevity
End Sub

- 或者 -

Sub FormInit()
    ' Add a column to the spreadsheet control
    vaSpreadSum.ActiveSheet.Columns.Count = 29

    ' Code cut for brevity
End Sub

实现相同目的的另一种方法是打开表单设计器,选择展开控件,显示属性窗口(如果尚未打开,请按 F4),并将 Cols 属性增加到 29。

于 2014-02-24T19:43:35.880 回答