2016-08-22 64 views
0

我已將一個組合框添加到表單,到目前爲止沒有其他格式。我有一個文本框,用戶輸入20到100之間的許多競爭對手(價值)。我想填充組合框,以便用戶可以在組合框中選擇1到100之間的競爭對手。因此,用戶將能夠點擊下拉菜單並從競爭對手名單中選擇競爭對手,例如競爭對手1到競爭對手100.
如果您需要任何額外信息,請讓我知道。格式化組合框

+0

你想,你在文本框中輸入的值將出現在組合框? – kiLLua

+0

因此,輸入到文本框中的值將是選項。如果輸入到文本框中的值是75,則組合框中的選項將從競爭者1到競爭者75。 – MyArmsFellOff

回答

0

試試這個,解釋包括:

  yourComboBox.Items.Clear() 'to make sure the ComboBox is empty before populating and to avoid duplicating records 
     If Val(yourTextbox.Text) > 0 Then 'basic checking 
      For x = 1 To Val(yourTextbox.Text) 'loop from 1 up to the value you entered into the textbox 
       yourComboBox.Items.Add(x) 'add the value of x which holds the current loop number/competitor 
      Next 
     End If