I recently started tampering with Windows store apps. I'm having trouble referencing my objects properly. At first, when trying to automatically update a ScrollViewer
object when a ComboBox
object changed, I couldn't get the value of the changed index.
Using menuDay.SelectedIndex
within my menuDay_SelectionChanged
event caused a System.NullReferenceException
. I fixed that by referencing my menuDay
object as such:
((ComboBox)sender).SelectedIndex
Now, within the same menuDay_SelectionChanged
event, I'm getting the same error when I try accessing the content of my ScrollViewer
, outSetList
.
I'm trying to set my ScrollViewer's content to a list of exercise activities. Too much to post. But I concatenate them using a single string.
string += "this stuff\n"
repeat.
And then I try to set it into the ScrollViewer
outSetList.content = string
I get the same System.NullReferenceException
error. It tells me that the object reference is not set to an instance of an object.
I'm pretty familiar with C#, objects, instances but nothing I've tried seems to have worked. I tried casting it, creating a variable using it as a type(outSetlist setlist = new outSetList
) among other things.
I'm sure it's a fairly simple answer but I can't find one anywhere.