Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Sunday, July 17, 2011

VB-46 : Find the square root of a given number

Design a VB application to find the square root of a given number

A)    Program Design : 



(B) Property(Controls Used) :

  •        2 Labels Number & Square root
  •        2 Text Boxes whose Index is 0&1 respectively...........Text Property is Zero for both..............and the Locked Property is True for the second Text Box (that is the text box for getting the result)
  •       One Command Button with Caption Find Square root.
(C) Attaching Code to the Object :

      Private Sub Command1_Click()
      Text2.Text = Sqr(Val(Text1.Text))
      End Sub

      Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
      If Index = 0 And (KeyAscii < 48 Or KeyAscii > 57) Then
      SendKeys (Char(8))
      End If
      End Sub


Possible Error  : Sub or Function Not Defined
====================================================================
=========================================================