M
Marc W.
I have been trying to cast an object I am getting from a SortedList for some
time now, into the object it is supposed to be, but it just won't work. Here
is the code:
(StudentLocation)(student.stuSchedules[dpdnPeriodSelection.SelectedText]).lo
cation = txtRoom.Text;
Every object in the stuSchedules array is a StudentLocation object. However,
SortedLists store all of their values as objects, so I need to convert it
back into the correct type so I can set one of the fields. However I keep
getting the error that 'object' does not respond to 'location'. I don't
understand how the compiler still thinks I am treating this as an object
because the typecast is right there!
This is getting really very frusterating. I have never had a problem like
this in any other language. So if someone could please give me a hint or
something as to what I am doing wrong, it would be greatly appreciated.
- Marc Weil
time now, into the object it is supposed to be, but it just won't work. Here
is the code:
(StudentLocation)(student.stuSchedules[dpdnPeriodSelection.SelectedText]).lo
cation = txtRoom.Text;
Every object in the stuSchedules array is a StudentLocation object. However,
SortedLists store all of their values as objects, so I need to convert it
back into the correct type so I can set one of the fields. However I keep
getting the error that 'object' does not respond to 'location'. I don't
understand how the compiler still thinks I am treating this as an object
because the typecast is right there!
This is getting really very frusterating. I have never had a problem like
this in any other language. So if someone could please give me a hint or
something as to what I am doing wrong, it would be greatly appreciated.
- Marc Weil