Home > Software engineering >  VB for help how to make the change with combol text content?
VB for help how to make the change with combol text content?

Time:09-25


After show the serial number as shown above, the drop-down, corresponding program fares can then show that the code should be how to write? To solve?

CodePudding user response:

Hypothesis show the serial number drop-down box called "Combo1", the total price textbox called "text1
"
 select case Combo1. Listindex 
Case 0
Text1. Text="20 yuan"
Case 1
Text1. Text="50 yuan"
Case...
End the select

CodePudding user response:

First of all, you should find combobox is click event, and then distinguish which a click, and then the corresponding display the data in the text

CodePudding user response:

 Dim X As Integer 

Private Sub Combo1_Click ()
Dim MM As Integer
MM=Val (Combo1. Text)
The Select Case MM
Case 1: X=15
Case 2: X=20
Case 3: X=25
Case 4: X=30
Case 5: X=35
End the Select
End Sub

Private Sub Form_Load ()
Combo1. Clear
For I=1 To 5
Combo1. AddItem I
Next I
Text1. Text=""
Text2. Text=""
End Sub

Private Sub Text1_Change ()
Dim AA As Integer
AA=Val (Text1. Text)
Text2. Text=AA * X
End Sub

In Combo1_Click set ticket prices, in the event of an Text1_Change can calculate the total price, very simple!
  • Related