Cannot modify expression because it is not a variable

后端 未结 5 921
情书的邮戳
情书的邮戳 2020-12-20 19:34

I\'m trying to get an UserControl (which has a grid on it) on a Windows Form to resize. The below code is what I have in the Form. The behavior I\'m getting is that the con

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-20 20:23

    grdNameValueProperties.Size.Width = this.Width - 8;
    grdNameValueProperties.Size.Height = this.Height -8;
    

    That code gives the error because Size is a value type, not a reference type. Reading this http://www.yoda.arachsys.com/csharp/parameters.html may help explain the difference between value types and reference types.

提交回复
热议问题