Click here to Skip to main content
15,895,667 members
Home / Discussions / C#
   

C#

 
Generalcut string if it is to long for a field Pin
stephan_00721-Apr-08 9:15
stephan_00721-Apr-08 9:15 
GeneralRe: cut string if it is to long for a field Pin
damianrda21-Apr-08 9:23
damianrda21-Apr-08 9:23 
GeneralRe: cut string if it is to long for a field Pin
Spacix One21-Apr-08 9:41
Spacix One21-Apr-08 9:41 
GeneralRe: cut string if it is to long for a field Pin
stephan_00721-Apr-08 9:47
stephan_00721-Apr-08 9:47 
Generalassembly in C code with a not so young compiler! Pin
turetschek21-Apr-08 8:22
turetschek21-Apr-08 8:22 
Generalwrong forum Pin
Luc Pattyn21-Apr-08 8:34
sitebuilderLuc Pattyn21-Apr-08 8:34 
GeneralRe: assembly in C code with a not so young compiler! Pin
ChrisKo21-Apr-08 10:05
ChrisKo21-Apr-08 10:05 
QuestionSortedList - KeyValuePair - InvalidCastException Pin
dennycrane21-Apr-08 7:59
dennycrane21-Apr-08 7:59 
I get an InvalidCastException in the bold part of the code (the "" and /object are not part of the code)


public void AthugaStafset()
{


SortedList SL = new SortedList();
SortedList SL2 = new SortedList();

SL.Add(0, "V1");
SL.Add(1, "V2");
SL.Add(2, "V3");
SL.Add(3, "V4");
SL.Add(4, "V5");

SL2.Add(0, richTextBox1.Text);
SL2.Add(1, richTextBox1.Text);
SL2.Add(2, richTextBox1.Text);
SL2.Add(3, richTextBox1.Text);
SL2.Add(4, richTextBox1.Text);


bool equal = Compare(SL, SL2);

if (equal)
{
richTextBox2.Text = "Right";
}
else
{
richTextBox2.Text = "They differ";
}
}

static bool Compare(SortedList SL, SortedList SL2)
{
if (SL.Count != SL2.Count)
{
return false;
}


foreach (KeyValuePair<object, string=""> item in SL)
{
if (!SL.Contains(item.Key))
{
// Return the moment we find a difference
return false;
}
}

// Must be the same
return true;
}
GeneralRe: SortedList - KeyValuePair - InvalidCastException Pin
carbon_golem21-Apr-08 8:34
carbon_golem21-Apr-08 8:34 
GeneralRe: SortedList - KeyValuePair - InvalidCastException Pin
dennycrane21-Apr-08 8:43
dennycrane21-Apr-08 8:43 
GeneralRe: SortedList - KeyValuePair - InvalidCastException Pin
carbon_golem21-Apr-08 8:48
carbon_golem21-Apr-08 8:48 
GeneralRe: SortedList - KeyValuePair - InvalidCastException Pin
dennycrane21-Apr-08 8:49
dennycrane21-Apr-08 8:49 
GeneralRe: SortedList - KeyValuePair - InvalidCastException Pin
carbon_golem21-Apr-08 9:17
carbon_golem21-Apr-08 9:17 
GeneralRe: SortedList - KeyValuePair - InvalidCastException Pin
dennycrane21-Apr-08 9:21
dennycrane21-Apr-08 9:21 
GeneralRe: SortedList - KeyValuePair - InvalidCastException Pin
carbon_golem21-Apr-08 9:24
carbon_golem21-Apr-08 9:24 
GeneralRe: SortedList - KeyValuePair - InvalidCastException Pin
dennycrane21-Apr-08 9:32
dennycrane21-Apr-08 9:32 
GeneralRe: SortedList - KeyValuePair - InvalidCastException Pin
Pete O'Hanlon21-Apr-08 9:39
mvePete O'Hanlon21-Apr-08 9:39 
GeneralRe: SortedList - KeyValuePair - InvalidCastException Pin
dennycrane21-Apr-08 9:46
dennycrane21-Apr-08 9:46 
GeneralRe: SortedList - KeyValuePair - InvalidCastException Pin
carbon_golem21-Apr-08 9:18
carbon_golem21-Apr-08 9:18 
GeneralRe: SortedList - KeyValuePair - InvalidCastException Pin
carbon_golem21-Apr-08 9:19
carbon_golem21-Apr-08 9:19 
GeneralRe: SortedList - KeyValuePair - InvalidCastException Pin
carbon_golem21-Apr-08 9:23
carbon_golem21-Apr-08 9:23 
GeneralRe: SortedList - KeyValuePair - InvalidCastException Pin
dennycrane21-Apr-08 9:29
dennycrane21-Apr-08 9:29 
GeneralRe: SortedList - KeyValuePair - InvalidCastException Pin
carbon_golem21-Apr-08 9:39
carbon_golem21-Apr-08 9:39 
GeneralRe: SortedList - KeyValuePair - InvalidCastException Pin
dennycrane21-Apr-08 9:45
dennycrane21-Apr-08 9:45 
GeneralRe: SortedList - KeyValuePair - InvalidCastException Pin
carbon_golem21-Apr-08 9:57
carbon_golem21-Apr-08 9:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.