vb.net - User-defined class always returns 0 -


I have a simple program, but I can not return this square to the area of ​​a rectangle; It always returns to 0, including class variables. I can not get this zodiac thing to work for life. Here's the main form:

  Personal category btnCalc_Click (Sender as object, and sender as EventArgs) handles btnCalc.High handle as new rectangle as 'dim strlength string' As the dim strWidth string double. Trips (TSTLextext, rectic lalent) double. Trypsers (TCTADAd.Text, Rect.Wide) 'Strongable = Inputbox ("Please input the length of the rectangle", "Calculate Area")' Double. Tryi purse (strileth, rect.Length) 'strWidth = InputBox ("Please input the width of the rectangle", "Count the area")' double. Trips (Stroydith, Ritch Width) LLLERIA Text = rectangle Getre The toasting and sub-class   

and here's the square

  public square rectangle _dblLength double _dblWidth as double private double as public property length Go back as time goes _dblLength set to go (double as value) if value & gt; 0 then _dblLength = value Else _dblLength = 0 termination if termination property is terminated. Return the width of the asset of the property double as the return _dblWidth set (double as the value) if the value & gt; 0 then _dblLength = value Else _dblLength = 0 end if end set end property "When you make a new call primarily, it generates variable, public sub new () _dblLength = 0 _dblWidth = 0 and public function GetArea ( ) Double return as _dblLength * _dblWidth End Function End Class    

Your Width Property: This setting is _dblLength but returning to _dblWidth .

_dblWidth will always be zero, so your count area will always be zero.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -