try this
登录 | 论坛导航 -> 华新鲜事 -> 求学狮城 | 本帖共有 1 楼,分 1 页, 当前显示第 1 页 : 本帖树形列表 : 刷新 : 返回上一页
<<始页  [1]  末页>>
作者:flybird111 (等级:3 - 略知一二,发帖:1320) 发表:2003-03-09 19:53:36  楼主  关注此帖评分:
问一个关于VB的问题我选用combobox(组合框),下拉选定的item如何去display在另一个text中. txtTemp.Text = ??? 说的白点儿:就是从下拉菜单(friend, colleague, classmate)一组中选中一个或几个,然后显示"friend.."在一个文本框中.how to implement? I know should use combox, but how to write code?
try this
first place one textbox and combobox on the form. name them text1 and combo1 respectively.....


Private Sub Form_Load()
Combo1.Clear

Combo1.AddItem "AAA"
Combo1.AddItem "BBB"
Combo1.AddItem "CCC"
Combo1.AddItem "DDD"

End Sub

Private Sub Combo1_Click()
Text1.Text = Combo1.Text
End Sub


or u can try this



Private Sub text1_gotfocus()
If Combo1.Text = "" Then
MsgBox "Please select a value from the list first."
Combo1.SetFocus
Exit Sub
Else
Text1.Text = Combo1.Text
End If
End Sub


Private Sub Form_Load()
Combo1.Clear

Combo1.AddItem "AAA"
Combo1.AddItem "BBB"
Combo1.AddItem "CCC"
Combo1.AddItem "DDD"

End Sub


Stray birds of summer come to my window to sing and fly away. And yellow leaves of autumn, which have no songs, flutter and fall there with a sign.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
论坛导航 -> 华新鲜事 -> 求学狮城 | 返回上一页 | 本主题共有 1 篇文章,分 1 页, 当前显示第 1 页 | 回到顶部
<<始页  [1]  末页>>

请登录后回复:帐号   密码