Hurkagurk

Hurkagurk

  • NA
  • 5
  • 35.5k

Cannot implicitly convert type 'string' to 'System.Drawing.Size'

Dec 3 2010 12:59 AM
I've searched around, and I'm not finding a solution to this one so I figured I'd ask you bright people:

Trying to pull form size information out of a database and pass it to a form upon instance.

The relevant code in the parent form is:
[code]
childForm.Size = (string)row["size"];
[/code]

and the relevant code in the childform is:
[code]
public string Size { get; set; }

and later, in the form initialization:
this.Size = new System.Drawing.Size(Size);
[/code]

I'm getting "Cannot implicitly convert type 'string' to 'System.Drawing.Size'".

When I change variable names and play around with it a bit, I'm getting: "Cannot implicitly convert type 'string' to 'System.Drawing.Point'"

The information in my Database is good - at runtime a messagebox in the initialization will show the proper window size.  But I'm unable to pass that information to the form properly.  Im sure it's a rookie mistake, but my web searches didn't show me a solution.  Any help would be greatly appreciated.


Answers (3)