Hi all,
Is there an easier way of setting the values of textbox controls, the way im using below is very repetitive and has to be run through every time a combobox1 is changed. Im also going to have to add a lot more case scenarios in the short future.
Code
Private Function setform()
Dim Xeng As Boolean
For Each ctl In Me.Controls
If TypeOf ctl Is MSForms.TextBox Then
ctl.Enabled = True
ctl.Locked = False
ctl.Value = ""
End If
Next
Select Case ComboBox1.ListIndex
Case 0 'BELL206B
Xeng = False
TextBox8.Locked = True
TextBox9.Enabled = False
TextBox9.Locked = True
TextBox9.Value = "N/A"
TextBox17.Enabled = False
TextBox17.Locked = True
TextBox17.Value = "N/A"
Case 1 'HUGHES269C
Xeng = False
TextBox8.Enabled = False
TextBox8.Locked = True
TextBox8.Value = "N/A"
TextBox9.Enabled = False
TextBox9.Locked = True
TextBox9.Value = "N/A"
TextBox16.Enabled = False
TextBox16.Locked = True
TextBox16.Value = "N/A"
TextBox17.Enabled = False
TextBox17.Locked = True
TextBox17.Value = "N/A"
Case 2, 3, 4, 5 'AS350B,BA,B2
Xeng = False
TextBox8.Locked = True
TextBox9.Locked = True
Case 6 'AS350B3
Xeng = False
Case 7 'AS355N
Xeng = True
End Select
If Xeng = False Then
TextBox8.Locked = True
TextBox9.Locked = True
TextBox18.Value = "N/A"
TextBox19.Value = "N/A"
TextBox20.Value = "N/A"
End If
TextBox18.Enabled = Xeng
TextBox18.Locked = Not Xeng
TextBox19.Enabled = Xeng
TextBox19.Locked = Not Xeng
TextBox20.Enabled = Xeng
TextBox20.Locked = Not Xeng
End Function
Display More