Message 1 of 7
Selecting a room
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a room ID stored as an integer in a datagrid and I am trying to modify the room using this as a way of finding the room object.
I get the element with the following:
Dim RoomID As ElementId = TryCast(objRow.Item("Element_Id"), ElementId)
then try to use
Dim objRoom As Room = doc.Element(RoomID)
to get the object, but it gives me an error:
System.NullReferenceException: Object reference not set to an instance of an object.
I know the elementID is the correct number, I am thinking it is the wrong type? or maybe its the Element() that i am doing wrong?!?
Any ideas or examples of something like this that work? c# or vb is fine, thanks!