Changes

ComboBox Control in VB6

939 bytes added, 03:34, 17 January 2008
/* Forms 2.0 ComboBox Properties */
The following lines were added (+) and removed (-):
Create a form, add 3 controls, a ComboBox "cboList", a CommandButton "cmdSubmit", and a multiline TextBox "txtOut". Option Explicit Private Sub cmdSubmit_Click()  cboList.TextColumn = 1  txtOut.Text = "values: " & vbCrLf & vbCrLf  txtOut.Text = txtOut.Text & "text = " & cboList.Text & vbCrLf & vbCrLf  cboList.TextColumn = 2  txtOut.Text = txtOut.Text & "text = " & cboList.Text & vbCrLf & vbCrLf End Sub Private Sub Form_Load()    cboList.ColumnCount = 2  cboList.ColumnWidths = "40;40"    Call cboList.AddItem("Lisa", 0)  cboList.List(0, 1) = "Smith"    Call cboList.AddItem("Stanley", 1)  cboList.List(1, 1) = "Smith"    Call cboList.AddItem("Ben", 2)  cboList.List(2, 1) = "Nelson"    Call cboList.AddItem("Stacy", 3)  cboList.List(3, 1) = "Springs"  End SubStudy the example above.  Note how the selected text changes.  Also note how what is displayed in the combo box changes.
Bureaucrat, administrator
16,192
edits