Thread: ComboBox
View Single Post
  #1 (permalink)  
Old 08-25-2008, 03:53 PM
ceaser's Avatar
ceaser ceaser is offline
Basic4ppc Veteran
 
Join Date: May 2008
Location: Paarl, South Africa
Posts: 306
Default ComboBox

Help (Again!)

The following code is when the user clicks on OptionButton2 to select a Total Station. I have three options: OptionButton1 is for a Engineering Level, OptionButton2 is for a Total Station and OptionButton3 is for a GPS. The idea is that the user can select different surveying instruments that he\she works with.

All the different setting for the different instruments are stored in an array called DF().

When the surveyor selects the settings for the first time, the index of the array will be "0".....DF(0)=0, DF(1)=0, DF(2)=0,etc.

What I then use is ComboboxName.SelectedIndex=DF(0), etc

It works fine but not with the last line in the next sub.

Sub OptionButton2_Click
'SaveData
OptionButton1.Checked=False
OptionButton3.Checked=False
InstMake.clear
InstMake.add ("Manual")
InstMake.add ("Leica")
InstMake.add ("Nikon")
InstMake.add ("Topcon")
InstMake.add ("Geodimeter")
InstMake.add ("Pentax")
InstMake.add ("Sokkia")
InstMake.add ("Trimble")
InstMake.add ("Fujiyama")
InstMake.add ("Precision")
DF(100)=1
InstModel.clear
InstMode.clear
InstMode.add ("Fine")
InstMode.add ("Coarse")
InstTrigger.clear
InstTrigger.add ("Instr")
InstTrigger.add ("PPC")
If DF(3)>0 Then InstMake.SelectedIndex=DF(3)
If DF(4)>0 Then InstModel.SelectedIndex=DF(4)
InstTrigger.SelectedIndex=DF(1)
InstMode.SelectedIndex=DF(15)
InstMode.Left=110 :Label31.Left=8
InstTrigger.Left=110 :Label32.Left=8
' get the instrument models
'CheckInstModel
InstModel.SelectedIndex=DF(4)
End Sub

InstModel will depend on what instrument make is selected, ie. if a Leica is selected, then the different models will be a TC1000, TC300, TC400,TC600...etc.

Now in the routine above DF(4) will be "0" when accessed for the first time, untill it has been changed by the user.

But the program keeps on telling me the value cannot be "0"

Please help.

Thanks
Michael
Reply With Quote