Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Object reference not set to an instance of an object

$
0
0
Hello all,
I am jumping into issue directly.. I have two forms;
First one is saving packages for rooms.. (its not neccessary for what, just describing)
Second one is listing rooms in datagridview ..
I have two constructor for First Form ;
        public PackageForm()
        {
            InitializeComponent();
            OdalarListele();
        }
        public PackageForm(int roomid)
        {
            roomID = roomid;
            cmbRoomNo.SelectedValue = roomID ;

        }


the variable "roomid" delivering from Second Forms datagridview.. (when user double-click to datagridview);

int roomID = Convert.ToInt32(dgvRooms.CurrentRow.Cells[0].Value);
PackageForm pf = new PackageForm(roomID);
this.Close();

at the first form when i assign "roomID to cmbRoomNo.SelectedValue" an error throws;

"Object reference not set to an instance of an object"

Please, help me!

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>