excel - 日期不会出现在列表框的文本框中
问题描述
我想知道是否有人可以帮助我,我有一个数据列表框,当您双击列表框中的行时,所有文本框都会填充列表框中的数据,包括 2 个不同的文本框,其中包含日期但它不显示日期为 DD/MM/YYYY 而不是显示数字。
有人可以帮帮我吗。
下面是代码。
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
If IsNull(Me.ListBox1.Value) Then
MsgBox "Please double click on the name line", vbExclamation, "Select a Name Line"
Else
If Me.ListBox1.List(Me.ListBox1.ListIndex, 0) <> "" Then
Me.CommandButton1.Enabled = False
Me.CommandButton2.Enabled = True
Me.TextBox1.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 1)
Me.TextBox1.Enabled = False
Me.TextBox1.BackColor = RGB(155, 295, 155)
Me.TextBox2.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 2)
Me.TextBox2.Enabled = False
Me.TextBox2.BackColor = RGB(155, 295, 155)
Me.TextBox3.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 3)
Me.TextBox3.Enabled = False
Me.TextBox3.BackColor = RGB(155, 295, 155)
Me.TextBox5.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 4)
Me.TextBox6.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 5)
Me.TextBox7.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 6)
Me.TextBox8.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 7)
Me.ComboBox1.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 8)
Me.TextBox9.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 9)
' Textbox10 it is the Date box
Me.TextBox10.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 10)
Me.TextBox37.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 11)
Me.TextBox38.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 12)
Me.TextBox39.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 15)
' Textbox11 it is the Date box
Me.TextBox11.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 13)
Me.TextBox12.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 14)
Me.TextBox13.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 16)
Me.TextBox13.Enabled = False
Me.TextBox13.BackColor = RGB(155, 295, 155)
End If
End If
End Sub
解决方案
例如:
Me.TextBox10.Value = Format(Me.ListBox1.List(Me.ListBox1.ListIndex, 10), "DD/MM/YYYY")
推荐阅读
- java - 如何使用视频视图和意图播放视频
- node.js - Docker 在 docker-compose up 上同时运行 Yarn update 和 npm update
- firebase - 客户的 GCP 结算帐号
- go - 测试用例中的 Golang 数据竞争条件
- android - 从 Android Sudio 3.2.1 切换到 4.1.2 后的 java.lang.UnsatisfiedLinkError
- memory-management - cudaMalloc 增加主机内存成本?
- python - 如何使用 Python 添加指向文件的超链接?
- php - Ajax, php CORS 标头
- assembly - 8086 汇编 SHR 指令除以 3 问题
- javascript - 示例中的故事书故事是什么类型