What is the datatype of a control's width property?
-
Hello, What is the data type returned from an asp.net control's Width property? I tried performing arithematic operations on it but asp.net(vb) recognised it as a syntax error. private int test label1.width = Me.width * (test/100) 'vb highlighted this as an error How do we perform arithematic on the width properties?
-
Hello, What is the data type returned from an asp.net control's Width property? I tried performing arithematic operations on it but asp.net(vb) recognised it as a syntax error. private int test label1.width = Me.width * (test/100) 'vb highlighted this as an error How do we perform arithematic on the width properties?
Hey, Clearly the width property is always an integer. The problem (I guess) in your code is that
Me.width * (test/100)
is not always an integer (eg. test = 3.. or so) But a float.. And C# (or VB.Net) does not convert (or cast) implicitly an integer into a float or decimal.. Just try this :label1.width =(int) Me.width * (test/100) //C# not VB
Good luck. -
Hello, What is the data type returned from an asp.net control's Width property? I tried performing arithematic operations on it but asp.net(vb) recognised it as a syntax error. private int test label1.width = Me.width * (test/100) 'vb highlighted this as an error How do we perform arithematic on the width properties?
Isn't it something like a System.Forms.Size? (Or perhaps Unit - that rings bells) "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox
-
Hello, What is the data type returned from an asp.net control's Width property? I tried performing arithematic operations on it but asp.net(vb) recognised it as a syntax error. private int test label1.width = Me.width * (test/100) 'vb highlighted this as an error How do we perform arithematic on the width properties?
To set the size use the Unit class To set the size of a font use the FontUnit class Its stored as a size structure The integer is available as read only you can't directly change it 1 line of code equals many bugs. So don't write any!! -- modified at 12:06 Thursday 30th March, 2006