Hi guys
I'm a total noob here! I have a question about this scenario.
I have UltraTabs (6 tabs in total). Each contains the text editors except they're bound to different columns in the sql table. Each text editor has a different name based on the tab its on. I looked at the sample project where you had this kind of setup whereby the ArrayList of the ComboEditor is set based on the OptionSet value selected. The problem I'm having is I have to refer to specific fields ON each tab for the description.
Here's some coding I used from your example. Please excuse any errors and feel free to correct me.
private void CreateDataSourcesForCombo() { #region ArrayList of Completion this.arrayListforCompletion = new ArrayList(3); this.arrayListforCompletion.Add(new Completion(2, supportingNameUltraTextEditor.Text + " and " + originalNameUltraTextEditor.Text + " at entry")); this.arrayListforCompletion.Add(new Completion(3, originalNameUltraTextEditor.Text + " only at entry")); this.arrayListforCompletion.Add(new Completion(6, "No Printing Required")); #endregion // ArrayList of Completion #region ArrayList of Batch this.arrayListforBatch = new ArrayList(6); this.arrayListforBatch.Add(new Batch(1, supportingNameUltraTextEditor.Text + " at entry, " + originalNameUltraTextEditor.Text + " at batching")); this.arrayListforBatch.Add(new Batch(2, supportingNameUltraTextEditor.Text + " and " + originalNameUltraTextEditor.Text + " at entry")); this.arrayListforBatch.Add(new Batch(3, originalNameUltraTextEditor.Text + " only at entry")); this.arrayListforBatch.Add(new Batch(4, supportingNameUltraTextEditor.Text + " and " + originalNameUltraTextEditor.Text + " at batching")); this.arrayListforBatch.Add(new Batch(5, originalNameUltraTextEditor.Text + " only at batching")); this.arrayListforBatch.Add(new Batch(6, "No Printing Required")); #endregion // ArrayList of Batch }
Obviously it's not inserting the TextEditor.Text part in the Combo.
Also, this is just for ONE of the tabs because of the TextEditor.Text names changing per tab.
I'm referring to the TextEditor.Text fields because I also use Validated on those fields if they are updated to change the description accordingly in the Combo.
Any suggestions?
I think I'm understanding what you're saying. However, I'll send you a sample of what I'm trying to achieve during the course of the day. Just a bit hectic at the moment. Maybe it will all make a bit more sense then.
Hello,
It's a little unclear what exactly you are looking for, however in the first question, it would seem you are simply looking to set the UltraComboEditor's DisplayMember and ValueMember properties.
In the second question, an ArrayList won't update the control automatically, this is by design. Its recommended that you use a datasource that sends change notifications like a BindingList. When a control is bound to a data source which does not implement System.ComponentModel.IBindingList (such as Array or ArrayList) there is no automated infrastructure for notifying the control of modifications to the data source. You are going to want to try calling the combo's DataBind method to force it to synchronize the control's list of items with the new values in the data source.
Let me know if you have any questions.
Also, another question. In regard to the following code:
#region ArrayList of Completion this.arrayListOfCompletion = new ArrayList(3); this.arrayListOfCompletion.Add(new Completion(2, supportingNameUltraTextEditor.Text + " and " + originalNameUltraTextEditor.Text + " at entry")); this.arrayListOfCompletion.Add(new Completion(3, originalNameUltraTextEditor.Text + " only at entry")); this.arrayListOfCompletion.Add(new Completion(6, "No Printing Required")); #endregion // ArrayList of Completion #region ArrayList of Batch this.arrayListOfBatch = new ArrayList(6); this.arrayListOfBatch.Add(new Batch(1, supportingNameUltraTextEditor.Text + " at entry, " + originalNameUltraTextEditor.Text + " at batching")); this.arrayListOfBatch.Add(new Batch(2, supportingNameUltraTextEditor.Text + " and " + originalNameUltraTextEditor.Text + " at entry")); this.arrayListOfBatch.Add(new Batch(3, originalNameUltraTextEditor.Text + " only at entry")); this.arrayListOfBatch.Add(new Batch(4, supportingNameUltraTextEditor.Text + " and " + originalNameUltraTextEditor.Text + " at batching")); this.arrayListOfBatch.Add(new Batch(5, originalNameUltraTextEditor.Text + " only at batching")); this.arrayListOfBatch.Add(new Batch(6, "No Printing Required")); #endregion // ArrayList of Batch
Whenever the text on either of the two text boxes is update/changed, how would I now have the change reflect on validated since it's part of the array? I used to use the textbox validated event but obviously I cannot use that now.
The two textboxes in question is: supportingNameUltraTextEditor.Text and originalNameUltraTextEditor.Text
Thanks Michael. I found where I went wrong btw. Looks like it's working like expected except for one thing.
With the following code, how do I set the DataValue for each member as the OptionSet is linked to the database to get the selected value.
private void DataSource_online01UltraOptionSet() { // Create a lookup table to be used when the selected item in the UltraOptionSet // is changed. The name of the data source (the key) is used to get the data source // object to be bound to the UltraComboEditor. // this.dataSourcesHashTable = new Hashtable(); this.dataSourcesHashTable[Strings.ArrayListOfCompletion] = this.arrayListOfCompletion; this.dataSourcesHashTable[Strings.ArrayListOfBatch] = this.arrayListOfBatch; // Get a sorted list of the keys to be bound to the UltraOptionSet. // string[] dataSourceMode = new string[2]; this.dataSourcesHashTable.Keys.CopyTo(dataSourceMode, 0); Array.Sort(dataSourceMode); this.online01UltraOptionSet.DataSource = dataSourceMode; }
Or do I need to set it somewhere else?
Thanks for following up. Hope it works out.