Link to home
Start Free TrialLog in
Avatar of dminx13
dminx13Flag for United States of America

asked on

How To Question

Hello~

Working on a C# Visual Studios 2010 project trying to create something but having some issues. Does anyone have any suggestions on what to use when you have a list of items and you want to select one of those items, look at it, then you click on another item and look at it, without getting a ArgumentOutOfRangeException? The first item can be clicked with no error. Second item throws the error. You can click continue and it shows the item but it always throws the error. Have tried using ItemsSelectionChanged and that is what is giving the error right now. If you can just give some direction at this point on what to try that would be great.

Thanks
D
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Well without seeing the code and knowing which control/s you are using or if the second click is in a different control it is difficult to tell.

Let say you are clicking on the same control maybe a ListBox, to select multiple items you need to set SelectionMode to Multiple.

Please post more information and code and the exception message and inner exception message.
Avatar of dminx13

ASKER

 private void InvTree_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            int h = e.Item.Index;
            inventory1.comboList1.ResetComboTree();
            inventory1.valueStrip1.Reset();
            var ItemData = savefile.items.items[InvTree.SelectedItems[0].Index];
            inventory1.valueStrip1.dye = Convert.ToInt32(ItemData.generator.dye_type);
            inventory1.valueStrip1.binding = Convert.ToInt32(ItemData.generator.item_binding_level);
            inventory1.valueStrip1.hireling = Convert.ToInt32(ItemData.hireling_class);
            inventory1.valueStrip1.Durability.Value = ItemData.generator.durability;
            inventory1.valueStrip1.Flags.Value = ItemData.generator.flags;
            inventory1.valueStrip1.legendary_item_level.Value = ItemData.generator.legendary_item_level;
            inventory1.valueStrip1.itemqualitylevel = ItemData.generator.item_quality_level;
            inventory1.valueStrip1.Max_Durability.Value = ItemData.generator.max_durability;
            inventory1.valueStrip1.stack_size.Value = ItemData.generator.stack_size;
            var rare_item_name = ItemData.generator.rare_item_name;
            try
            {
                inventory1.comboList1.sno_affix_string_list.Value = rare_item_name.sno_affix_string_list;
                inventory1.comboList1.item_name_is_prefix.Checked = rare_item_name.item_name_is_prefix;
                inventory1.comboList1.item_string_list_index.Value = rare_item_name.item_string_list_index;
                inventory1.comboList1.affix_string_list_index.Value = rare_item_name.affix_string_list_index;
            }
            catch { }
            this.inventory1.comboList1.SetComboTree((ComboTreeBox)this.inventory1.comboList1.ComboLayout.GetControlFromPosition(1, 0), ItemData.generator.gb_handle.gbid.ToString());
            for (int i = 0; i <= ItemData.generator.base_affixes.Count - 1; i++)
            {
                if (ItemData.generator.base_affixes.Count > 0)
                    this.inventory1.comboList1.SetComboTree((ComboTreeBox)this.inventory1.comboList1.ComboLayout.GetControlFromPosition(1, i + 1), ItemData.generator.base_affixes[i].ToString());
            }

Open in new window

Please post more information and the exception message and inner exception message. Please also indicate on which line it occurs on.
Avatar of dminx13

ASKER

Error occurs on line 6. ArgumentOutOfRangeException was unhandled. See attached screenshot.
c--Error.png
Avatar of dminx13

ASKER

Wondering if anyone has anything more on this. I added code and error and no one has responded. I have been pulled off the project so if I don't hear anything I'll just delete this question. Thanks!
Deanna
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial