Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Area Selection by combo boxes


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-29-2008, 10:38 AM
Senior Member
 
Join Date: Mar 2008
Posts: 103
Default Area Selection by combo boxes

Hi all,

We want to select sepecif districts and sub districts as well under a selected division from the combo boxes used. And want to clear the value of district and sub district when there is a change in the division selection.

The code works but with a error message.

Please have a look and help.

regards,
Attached Files
File Type: sbp area Selection.sbp (6.1 KB, 15 views)
Reply With Quote
  #2 (permalink)  
Old 04-29-2008, 11:16 AM
Senior Member
 
Join Date: May 2007
Posts: 130
Awards Showcase
Beta Tester 
Total Awards: 1
Default

The SelectedIndex=-1 that triggers errors.
You may consider assigning these combobox at index 0 to be "" blank or "-none-" then you can use or initialized selectedIndex=0.
__________________
Rioven

Sony Ericsson XPERIA X1i WM6.1
480x800 Display Resolution
with QWERTY keyboard
Reply With Quote
  #3 (permalink)  
Old 04-29-2008, 11:24 AM
Senior Member
 
Join Date: Mar 2008
Posts: 103
Default

Hi,

The same code (cmbthana.selectedindex=-1) works for the sub districts(cmbthana combo box) without any error message, then wonder what is the cause for not working with the districts (cmbzilla combo box).


regards,
Reply With Quote
  #4 (permalink)  
Old 04-29-2008, 12:54 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 707
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Hi,
ComboBox1.SelectedIndex=-1 does not mean clear the selected text.
You must clear the text of the selected item first.

As soon as you have filled a ComboBox and selected an item then ComboBox1.SelectedIndex=-1 gives an error.

ComboBox1.Clear does not clear the displayed text.
Because, generally, a default selection is made.

But why, after having initialized a combobox, not preselect the first item with ComboBox1.SelectedIndex=0 as the default, so the user has already one, and it avoids also your problem in a different way.

I have joined a modified code that solves your problem, and shows better the solution than the text.

For comparison, to show another way, I have replaced the
If Then
Else If
End If etc

by
Select
Case 0
Case 1
.
.
End Select

Best regards
Attached Files
File Type: sbp area Selection_1.sbp (7.5 KB, 18 views)
__________________
Klaus
Switzerland
Reply With Quote
  #5 (permalink)  
Old 04-30-2008, 05:36 AM
Senior Member
 
Join Date: Mar 2008
Posts: 103
Default

Hi klaus,

Regards and thanks.

Your help is appreciated.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Clearing a combobox's text area in code Ricky D Questions & Help Needed 6 10-02-2008 10:31 AM
Combo box selection changed event mozaharul Questions & Help Needed 1 05-22-2008 08:32 AM
Contacts and List Boxes Oran Questions & Help Needed 9 01-22-2008 08:08 PM
Battery Status with Language Selection. FAFILI Share Your Creations 0 10-15-2007 11:47 AM
Treeview and check-boxes BjornF Questions & Help Needed 2 06-26-2007 04:45 PM


All times are GMT. The time now is 01:26 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0