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:

childForm.Size = (string)row["size"];

and the relevant code in the childform is:

public string Size { get; set; }

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

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.

Hi,

According to http://msdn.microsoft.com/en-us/library/system.drawing.size.aspx there are no constructor that takes a string as a parameter.
You have to convert the Size string to a Point struct og two Int32.

If you could tell what the structure of your Size string is, then I could help with the conversion.

Hope this helped.

- Hmortensen

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.