【问题标题】:textbox displays wrong color文本框显示错误的颜色
【发布时间】:2019-09-21 16:01:43
【问题描述】:

我有一个错误:

我的 Microsoft Access 报告有一个文本框,它的前景色应该是黑色,但显示为粉红色。

达到了将前景色设置为黑色的代码,前景色设置为黑色,但是当报告完成时,文本框显示一个粉红色的数字。

我的代码中没有其他对文本框的引用。

默认的文本框前景色是#7F7F7F,它是灰色的。

同样的代码正确地将其他文本框设置为黑色前景色。

我在文本框之间交叉检查了属性,它们都是相同的。

我可能会错过什么?

这是设置文本框的函数调用:

SetPointsTextBox frmWeeklyMotivationSystemReport2.Controls!txtSaturday3, status

Sub SetPointsTextBox(textbox As Control, status As clsStatus2)
  If status.DisplayTodaysPoints = 0 And status.DayEvent > 0 Then
    textbox = DisplayEventasString(status.DayEvent)
    textbox.ForeColor = vbBlue
  Else
    textbox = status.DisplayTodaysPoints
    If status.status = 4 Then
      If status.DisplayTodaysPoints > 0 Then
        textbox.ForeColor = vbRed
      Else
        If status.DisplayTodaysPoints = 0 Then
          textbox = "" 
        Else
          textbox = 0 
          textbox.ForeColor = RGB(205, 155, 29)
        End If
      End If
    Else
      If status.DisplayTodaysPoints < 0 Then
        textbox.ForeColor = vbRed
      ElseIf status.status = 2 Or status.status = 9 Then
        textbox.ForeColor = vbBlue
      Else
        textbox.ForeColor = vbBlack 'code gets to here and changes the forecolor to 0
      End If
    End If
  End If
End Sub

【问题讨论】:

  • 这不是我们可以复制的问题。也许您应该删除并重新创建文本框。
  • 删除并重新创建控件有效。谢谢你。太糟糕了,我无法将评论标记为答案。

标签: ms-access textbox


【解决方案1】:

删除并重新创建控件有效。感谢您的有用建议。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-09
    • 2018-05-18
    相关资源
    最近更新 更多