![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I noticed a strange behaviour on combobox related to the SelectionChanged event. I'll try to explain what happens. I have 2 comboboxes: the first one (cmbBrand) is filled with BRAND values from a single column table, the second combobox (cmbModel) is filled with MODELS values form a two columns (BRAND, MODELS) table. At runtime, before entering the input routine, I call the Cleanup routine containing the following instructions
cmbBrand.SelectedIndex=-1 cmbModel.SelectedIndex=-1 During input, the program fires a cmbBrand_SelectionChanged (Index, Value) event that filters the two colum table based on the selected BRAND, and then cleanups and reloads the cmbModel in order to show only the Models of the selected Brand. After input, the data are saved to a SQL table and then the program calls again the above Cleanup routine. At that point the program raises an "Object reference not set to an instance of an object" and points to the cmbBrand.SelectedIndex=-1 instruction. Commenting out the entire SelectionChanged routine, the Cleanup routine is called again and again without errors. Here is the routine Sub cmbBrand_SelectionChanged (Index, Value) tblModel.Filter("MODEL_BRAND = " & SurrLastItem(Value)) cmbModel.SelectedIndex = -1 cmbModel.Clear For k=0 To tblModel.RowCount-1 cmbModel.Add(tblModel.Cell("MODEL_NAME",k)) Next k tblModel.Filter("") End Sub SurrLastItem returns a string enclosed between singles quotes. Is anyone here that could give me please any help? Many thanks Mimmo |
|
|||
|
Hello Erel,
both the instructions are in the CleanFields routine togheter with other field cleanup instructions Sub CleanFields txtID.Text = "" chkJava14.Checked = False .... cmbModel.SelectedIndex = -1 cmbBrand.SelectedIndex = -1 .... txtMACAddress.Text = "" End Sub The routine is called 2 times: before accepting the input and after saving the record. In the meantime (during the input), the cmbBrand_SelectionChanged is fired Many thanks for your help Mimmo |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Keypress and SelectionChanged.. | robee9931 | Questions & Help Needed | 1 | 05-27-2008 04:08 PM |
| table: SelectionChanged() and SelectedRow | stbi | Questions & Help Needed | 7 | 12-21-2007 04:14 AM |
| SelectionChanged work in desktop, but not in ppc?? | laiyilam | Questions & Help Needed | 1 | 09-10-2007 01:52 PM |
| Listview and SelectionChanged | magi6162 | Questions & Help Needed | 11 | 09-06-2007 10:02 AM |
| Showing a form in a SelectionChanged event | specci48 | Questions & Help Needed | 3 | 05-18-2007 03:05 PM |