Dreamweaver,表单中有个列表框和一个文本域,怎样让文本域的内容和列表框的内容关联起来??
2个回答
2015-03-27
展开全部
Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar.ToString() = Chr(13) Then
Dim str As String = TextBox1.Text
If Not ListBox1.Items.Contains(str) Then
ListBox1.Items.Add(str)
End If
End If
End Sub
Private Sub btn_Remove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ListBox1.SelectedIndex > 0 Then
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
End If
End Sub
Private Sub btn_Clear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ListBox1.Items.Clear()
End Sub
If e.KeyChar.ToString() = Chr(13) Then
Dim str As String = TextBox1.Text
If Not ListBox1.Items.Contains(str) Then
ListBox1.Items.Add(str)
End If
End If
End Sub
Private Sub btn_Remove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ListBox1.SelectedIndex > 0 Then
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
End If
End Sub
Private Sub btn_Clear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ListBox1.Items.Clear()
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询