You are here:

Visual Basic/Vb Combobx Locked and unlocked through condition

Advertisement


Question
Hi Sir ,

Actually i want to use combobox locked property with condition

i have one combobox with name cmbDUR when i click on it the cmbRATE gotfocus and show the RATE in cmbRATE combobox

here for every duration as per the gym package rate is different

actually client want he cannot add rate > rate

for eg if i select 3 months from cmbDUR
cmbRATE is showing 1500

so client want that user shouldn't type value less that 1500 , he can able to type value more than 1500

if you have any different suggestion for this logic that's also appreciated

Answer
sample code:
have another combo2 visible =false and add this code:

Private Sub Command1_Click()
Dim i As Integer
Combo1.ListIndex = 0
For i = 0 To Combo1.ListCount - 1
Combo1.ListIndex = i
If Combo1.Text <= Val(Text1) Then Combo2.AddItem Combo1.Text
Next
Combo1.Clear
For i = 0 To Combo2.ListCount - 1
Combo2.ListIndex = i
Combo1.AddItem Combo2.Text
Next
Combo2.Clear
End Sub

Private Sub Form_Load()
Combo1.AddItem "100"
Combo1.AddItem "200"
Combo1.AddItem "300"
Combo1.AddItem "400"
Combo1.AddItem "500"
Combo1.AddItem "600"
Combo1.ListIndex = 0
End Sub

make suitable changes

Visual Basic

All Answers


Answers by Expert:


Ask Experts

Volunteer


Ravindra

Expertise

visual basic application programming from design to access information, sql, engineering and commercial applications. access databases, excel.(VB6) basic questions in vb 2008. Optional: 1)a large number of people want me to do work which takes some time and effort. can do projects in vb 2008. Pl.note that i would like to be paid for such work. 2) if you want me to spend quality time and do special work, i expect to be paid a reasonable price for my time. 3) if you are pleased with my reply you could consider a good amount. 4) you can visit my website http://ravindra.coolpage.biz

Experience

programming since the past 15 years. have completed a large number of projects in Industrial applications, finance,accounts, correspondence. excel macros etc

Education/Credentials
engineering, management degrees.

Past/Present Clients
project work for a Norway company,USA company and a Canadian company completed. Freelance Project work and Teaching. helping programmers with their work
teaching vb

©2016 About.com. All rights reserved.