我有一个包含月份名称的列表视图。我有一个月份日历控制。我想知道这是否可能我点击列表视图中的月份名称。它显示月份控制中的月份名称?
Dim arr(3) As String
Dim itm As ListViewItem
arr(0) = "2015"
arr(1) = "Jan"
itm = New ListViewItem(arr)
ListView1.Items.Add(itm)
arr(0) = "2015"
arr(1) = "feb"
itm = New ListViewItem(arr)
ListView1.Items.Add(itm)
arr(0) = "2015"
arr(1) = "Mar"
itm = New ListViewItem(arr)
ListView1.Items.Add(itm)
arr(0) = "2015"
arr(1) = "Apr"
itm = New ListViewItem(arr)
ListView1.Items.Add(itm)
在这部分中,我在文本框中获取月份名称。我想在月份控制中显示月份名称
Private Sub ListView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.Click
Dim tt As String
Dim tt1 As String
tt = ListView1.SelectedItems.Item(0).SubItems(1).Text
tt1 = ListView1.SelectedItems.Item(0).SubItems(0).Text
TextBox1.Text = tt.ToString & vbCr & tt1
End Sub
有什么建议吗?
答案 0 :(得分:1)
将代码添加到Listview中单击
Dim sr As New SelectionRange()
sr.Start = DateTime.Parse(Me.TextBox1.Text)
Me.MonthCalendar1.SelectionRange = sr