vba - Spread Designer 6.0 Visual Basic 6.0 复选框默认选中

标签 vba vb6

我是 VB6 新手(我知道......它很旧,但我们仍在使用)

我遇到了一个旧网格的问题,我必须对其进行更改。正如您在下图中看到的,该网格是在 Spread Designer 中设计的,我需要做的只是在表单加载时默认选择“更改”列。 我在这里搜索了可以更改此列属性的位置,到目前为止我发现的唯一内容是右键单击并单击编辑时弹出的“单元格类型”。

有人可以给我指出正确的方向吗?

Spread Designer 6.0 visual basic

我相信这是我可能需要做出改变的地方。

Private Sub GrdPriceChanges_LeaveCell(ByVal Col As Long, ByVal Row As Long, ByVal NewCol As Long, ByVal NewRow As Long, Cancel As Boolean)
Dim VatRate As Variant
Dim CostPrice As Variant
Dim SellPrice As Variant
Dim vData As Variant
Dim Margin As Variant

    If Col = 9 Then
        GrdPriceChanges.Row = Row
        GrdPriceChanges.Col = 9
        If CellPrice <> GrdPriceChanges.Value And CellPrice <> 0 Then
            GrdPriceChanges.Col = 11
            GrdPriceChanges.Value = 1
            
            GrdPriceChanges.GetText 12, Row, VatRate
            GrdPriceChanges.GetText 9, Row, SellPrice
            GrdPriceChanges.GetText 8, Row, CostPrice
            GrdPriceChanges.Col = 10
            GrdPriceChanges.Value = CalculateMargin(Val(VatRate), Val(CostPrice), Val(SellPrice))
        End If
        
    ElseIf Col = 10 Then
        GrdPriceChanges.Row = Row
        GrdPriceChanges.Col = 10
        If CellMargin <> GrdPriceChanges.Value And Val(CellMargin) <> 0 Then
            Margin = GrdPriceChanges.Value
            GrdPriceChanges.Col = 11
            GrdPriceChanges.Value = 1
            
            GrdPriceChanges.GetText 12, Row, VatRate
            GrdPriceChanges.GetText 9, Row, SellPrice
            GrdPriceChanges.GetText 8, Row, CostPrice
            GrdPriceChanges.Col = 9
            GrdPriceChanges.Value = SuggestPrice(Val(CostPrice), Val(Margin), Val(VatRate))
        End If
    End If

    GrdPriceChanges.Col = 9
    GrdPriceChanges.Row = NewRow
    CellPrice = Val(GrdPriceChanges.Value)
    GrdPriceChanges.Col = 10
    GrdPriceChanges.Row = NewRow
    CellMargin = GrdPriceChanges.Value

End Sub

最佳答案

加载表单时选择单元格:

Private Sub Form_Load()
   GrdPriceChanges.SetActiveCell 10, 1
End Sub

加载表单时选择:

Private Sub Form_Load()
   GrdPriceChanges.SetSelection 10, 0, 10, GrdPriceChanges.MaxRows
End Sub

关于vba - Spread Designer 6.0 Visual Basic 6.0 复选框默认选中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66352809/

相关文章:

dll - VB6动态添加DLL引用

utf-8 - 如何解码包含阿拉伯字符的(百分比编码 URL)?

ms-access - 我希望将特定的 Access 表字段导出到特定的 Excel 单元格。我的 vba 代码无法运行

vba - 选择案例错误 2007

Excel Vba 宏错误 400 通过电子邮件发送当前工作表

c++ - 将无符号整数从 C++ COM 对象传递到 VB6

excel - 将特定单词表的内容复制到excel

excel - 在 Excel VBA 中对向量进行排序

mysql - 通过 inno setup 使用 mysql 创建 vb6 设置

c# - 为什么C#null在VB6中被翻译成Empty,而不是Nothing