I am regularly getting an exception "Object Reference Not Set to An Instance of an Object".
I am not a natural coder. I get that something isn't set, but can't figure out what it is, nor how to fix it. Can anyone recreate the error, or better still, offer a solution?
I realise it's a long shot....
Code: Select all
if(repo_used == false)
{
Bitmap newimg = Imaging.CaptureDesktopImage(new Rectangle(start_x, start_y, width, height));
//save screenshot
newimg.Save(ref_combo, System.Drawing.Imaging.ImageFormat.Jpeg);
}
else
{
Ranorex.Unknown itemAdapter = item_in.CreateAdapter<Ranorex.Unknown>(false);
Bitmap newimg2 = Ranorex.Imaging.CaptureImage(itemAdapter);
//save screenshot
newimg2.Save(ref_combo, System.Drawing.Imaging.ImageFormat.Jpeg);//<<<<<<<<<<<<<<<<<Object Reference not set to an instance of an object
}