[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How To Question

Posted on 2014-01-25
6
Medium Priority
?
206 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 64

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 64

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 64

Accepted Solution

by:
Fernando Soto earned 2000 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

656 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