c# - Async error of {"Parameter is not valid."} when working with windows forms -


i have simple windows form has button click loads listbox of named elevations, when 1 of elevations clicked on id belonging elevation passed function creates bitmap , returns original calling function. keep getting these weird errors.

i keep getting {"parameter not valid."} error.

any ideas whats going on here?

i've added 2 screen shots, 1 of window form , 1 of error.

   async void lbelevations_mouseclick(object sender, mouseeventargs e)         {             var bitmapelevation = await showelevation();         }          async task<bitmap> showelevation()         {             int id = int.parse(this.lbelevations.selectedvalue.tostring());             bool ispdf = false;             bitmap bitelevation = new bitmap(0, 0);              bool rotate90 = false;             string action = "getelevation";             ielevation elev = await elevationmanagerdl.getelevationasync(id);               action = action.tolower();             rotatefliptype rotateflip = rotate90 ? rotatefliptype.rotate90flipnone : rotatefliptype.rotatenoneflipnone;              //elevation / shop drawing             if (action == "getelevation")             {                 #region elevation                 if (ispdf)                 {                     using (var pdf = await alumcloudplansbl.manager.getelevationpdfasync(elev, true))                     {                         //pdf                     }                 }                 else                 {                     using (bitelevation = await alumcloudplansbl.manager.getelevationdrawingasync(elev, true, rotateflip, false))                     {                         //canvas                     }                 }                 #endregion             }              return bitelevation;         } 

the error

the list box

the problem having constructing bitmap 0 height , width:

the following code raise exception:

try {     bitmap b = new bitmap(0, 0); } catch (argumentexception ex) {     messagebox.show(ex.tostring()); } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -