我是 VB6 新手(我知道......它很旧,但我们仍在使用)
我遇到了一个旧网格的问题,我必须对其进行更改。正如您在下图中看到的,该网格是在 Spread Designer 中设计的,我需要做的只是在表单加载时默认选择“更改”列。 我在这里搜索了可以更改此列属性的位置,到目前为止我发现的唯一内容是右键单击并单击编辑时弹出的“单元格类型”。
有人可以给我指出正确的方向吗?
我相信这是我可能需要做出改变的地方。
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/