Solved

How To Question

Posted on 2014-01-25
6
198 Views
Last Modified: 2014-05-20
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
0
Comment
Question by:dminx13
  • 3
  • 3
6 Comments
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 39810135
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.
0
 

Author Comment

by:dminx13
ID: 39810619
 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

0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 39810691
Please post more information and the exception message and inner exception message. Please also indicate on which line it occurs on.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:dminx13
ID: 39810725
Error occurs on line 6. ArgumentOutOfRangeException was unhandled. See attached screenshot.
c--Error.png
0
 

Author Comment

by:dminx13
ID: 39871372
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
0
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 39872374
Run the program, when it throws the exception highlight this part of the statement on line 6,
InvTree.SelectedItems[0].Index , the right click on the highlighted part of the line and select "Add Watch". If the Watch windows was not open at the bottom of the window it will open. What is the vale in the Value column? Also what is the value in the Type column.

Also in the Exception dialog box click on the words "View Detail...", Another window will open  expand the only node, along the left side find the line with Inner Exception and post the value on that line if it has a value in it.

By the look of the exception you posted it looks as if the value might be a 'O' and not a digit.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now