473,387 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ListView, MDR error (C#)

9
Hey everyone.. I know the code below is a mess, but I have no idea what is going wrong. I am getting an MDR error whenever I do the foreach loop. If I comment out the loop it works fine, but ofcourse I only get one addition into my listview. Also the loop is not what is throwing the error, if I comment everything but the message box it works. If anyone has any ideas (feel free to slap me arround for some thing stupid)

Expand|Select|Wrap|Line Numbers
  1.         private void listskills()
  2.         { 
  3.             ListView thislist = new ListView();
  4.  
  5.             foreach (Skill sk in m_skilllist)
  6.             {
  7.                 //MessageBox.Show(sk.Name);
  8.  
  9.                 thislist = (ListView)Thistab.Controls["bottompanel"].Controls["tabControl2"].Controls["tabPage3"].Controls["tabControl3"].Controls["tab_" + sk.groupID].Controls["slst_" + sk.groupID];
  10.  
  11.  
  12.                 ListViewItem thisitem = new ListViewItem("duh");
  13.  
  14.                 //thisitem.Name = sk.Name;
  15.                 //thisitem.Text = sk.Name + "(" + sk.Rank + ")";
  16.                 //thisitem.Text = "duh";
  17.                 //thisitem.SubItems.Add(sk.level);
  18.                 //thisitem.SubItems.Add(sk.skillpoints);
  19.                 //thisitem.SubItems.Add("21344123");
  20.  
  21.  
  22.                 thislist.Items.Add(thisitem);
  23.  
  24.             }
  25.         }
Dec 13 '07 #1
2 1342
kenobewan
4,871 Expert 4TB
Where do you derive Skill sk in m_skilllist and what is the error?
Dec 13 '07 #2
Tenowg
9
I am sorry, pretty new to c# and Visual Studio 2008. I Believe I got the error type wrong. Anyways since then I have changed my code to work, but I would still like to resolve this, so not to do it again.

sk is derived from a private variable declared in the same class.

Expand|Select|Wrap|Line Numbers
  1.  
  2.                   foreach (Skill sk in m_skilllist)  //sk derived from private delcare in same class. This method is called when the m_skilllist is set. The code for setting m_skilllist is executed from a static class which downloads an XML file and parses.
  3.  
  4.  
  5.  
on an interesting note, the code completed the foreach loop (which contains about 115 items. The error tripped when the code tried to exit the method..

The error type was not the normal exception, but one that tripped and took me to the end of the Program. Listing it after the Application.run command.

I hope this information is not to vague, but if any of this makes sense (and i do understand if it doesn't, lol) please help me understand why this happened.
Dec 15 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Mike Barrett | last post by:
I have a strange one here and I believe it is a bug. I googled it and saw others having a similar issue and nobody seems to have a fix. I will take another shot. I get this ERROR MESSAGE... ...
3
by: pointBoarder | last post by:
I'm following the article from http://support.microsoft.com/default.aspx?scid=kb;en-us;155178 The above article explains how to fill a listview. For some reason I keep recieving "User-defined...
6
by: VM | last post by:
How can I fill up a listview with text file contents? My listview has two columns and the first column fills up with a while loop: while (myString != null) { myString = sr.Readline();...
1
by: Ray Mitchell | last post by:
Hello, In the following code assume that the ListView object "myListView" has been properly created. What I am attempting to do is add a string as a list view item, then read the various string...
6
by: Vanessa | last post by:
With this program I can do one selection, but upon the second I get an error where ///////////////// is indicated. Please help. using System; using System.Drawing; using System.Collections;...
2
by: Aron Henning | last post by:
I have a ListView that contains the subfoldes of a local drive. Whan i click on a subfolder the listbox should display the subfolders of this folder instead. the funktion is as follows: private...
0
by: Mike Barrett | last post by:
I have a strange one here and I believe it is a bug. I googled it and saw others having a similar issue and nobody seems to have a fix. I will take another shot. I get this ERROR MESSAGE... ...
3
by: Matt Michael | last post by:
I have a listview control and a collection object right now that I'm trying to pass information to and from. Whenever I click on the checkbox, I want it to remove certain listview items and add...
0
by: Ryan Dawson | last post by:
Hello. I am getting an error when trying to remove/access items inside of a listview: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter...
5
by: Joza | last post by:
Hi! I'm getting error when selecting items in ListView control, it says ArguementOutOfRangeExceptions. That happens in SelectIndexChange event. I have tryed with try...catch but there's no...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.