J jothis Active Member Licensed User Nov 2, 2010 #1 Hi Friends I Writed A Program With Combobox Please See The Attachment My Problem is When i Select Kerala As The State The District Combobox will show the districts in kerala . I Selected Thrissur as District. Then I changed State To Tamil Nadu. But The Thrissur Is Still there ! . What Should I Do To Clear This Problem? I used This Code Code: Copy Combobox2.Clear Please Help Me Jothis :sign0085: Attachments New Thread.zip New Thread.zip 1.6 KB · Views: 350
Hi Friends I Writed A Program With Combobox Please See The Attachment My Problem is When i Select Kerala As The State The District Combobox will show the districts in kerala . I Selected Thrissur as District. Then I changed State To Tamil Nadu. But The Thrissur Is Still there ! . What Should I Do To Clear This Problem? I used This Code Code: Copy Combobox2.Clear Please Help Me Jothis :sign0085:
specci48 Well-Known Member Licensed User Longtime User Nov 2, 2010 #2 Hello Jothis, to clear even the actual selection of a combobox you can use this undocumented "feature": Code: Copy ComboBox2.Clear ComboBox2.Text = "" The .Text is not provided by the syntax help so you have to type it in manually. specci48
Hello Jothis, to clear even the actual selection of a combobox you can use this undocumented "feature": Code: Copy ComboBox2.Clear ComboBox2.Text = "" The .Text is not provided by the syntax help so you have to type it in manually. specci48
klaus Expert Licensed User Longtime User Nov 2, 2010 #3 I would suggest you to add this line ComboBox2.SelectedIndex=0 at the end of the ComboBox1_SelectionChanged routine. This selects automatically the first entry in in ComboBox2. Personally I would also add ComboBox1.SelectedIndex=0 just before Form1.Show in the App_Start routine. This selects by default the first entry in ComboBox1. The default selected entries could also be initialised with values from an Init file. Attached a modified version. Best regards. Attachments LIST.sbp LIST.sbp 1.5 KB · Views: 361
I would suggest you to add this line ComboBox2.SelectedIndex=0 at the end of the ComboBox1_SelectionChanged routine. This selects automatically the first entry in in ComboBox2. Personally I would also add ComboBox1.SelectedIndex=0 just before Form1.Show in the App_Start routine. This selects by default the first entry in ComboBox1. The default selected entries could also be initialised with values from an Init file. Attached a modified version. Best regards.
J jothis Active Member Licensed User Nov 2, 2010 #4 Thank you specci48 and klaus jothis :sign0060::sign0060: