Why the Combox.SelectedItem as DataRowView is not casting?

65 Views Asked by At

I have a combox and trying to cast its SelectedItem property to DataRowView like this

    DataRowView drFromWareHouse = cmbFromWareHouse.SelectedItem as DataRowView;

but it is showing redline and when I move the Cursor on it. It shows me cmbFromWareHouse does not exist in the current context. Kindly guide me what's going wrong with it?

1

There are 1 best solutions below

0
On BEST ANSWER

The variable "cmbFromWareHouse" is out of scope. You can't access it from where you are trying to access it from