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 3, 2011

VB-32 : Add 2 matrices of size mXn

Write a VB application to add two matrices of size mXn and display the resultant matrix.
Give your applicationn a splashscreen also.


A)    Program Design : 






(B) Property(Controls Used) :

  1. Label    : Caption - Rows in Matrix
  2. Labe2  : Caption - Columns in Matrix
  3. Label3    : Caption -Matrix 1
  4. Label4    : Caption - Matrix 2
  5. Label5    : Caption -Addition Matrix
  6. TextBox1    :Text property should kept blank
  7. TextBox2    :Text property should kept blank
  8. Command Button1   : Caption - Set Rows and Columns
  9. Command Button2  : Caption - Add Matrix
  10. Grid1   : 
  11. Grid2   : 
  12. Grid3   : 

(C) Attaching Code to the Object :
(Code doesn't give here to get  a splashscreen  application )




Private Sub Command1_Click()
Grid1.Rows = Text1.Text
Grid1.Cols = Text2.Text

Grid2.Rows = Text1.Text
Grid2.Cols = Text2.Text

Grid3.Rows = Text1.Text
Grid3.Cols = Text2.Text

End Sub
Private Sub Command2_Click()
For i = 0 To Grid3.Rows - 1
For j = 0 To Grid3.Cols - 1
Grid1.Row = i
Grid1.Cols = j

Grid2.Row = i
Grid2.Cols = j

Grid3.Row = i
Grid3.Cols = j

Grid3.Text = Val(Grid1.Text) + Val(Grid2.Text)
Next j
Next i

End Sub

Private Sub Grid1_KeyPress(KeyAscii As Integer)
Grid1.Text = Grid1.Text + Chr(KeyAscii)
End Sub
Private Sub Grid2_KeyPress(KeyAscii As Integer)
Grid2.Text = Grid2.Text + Chr(KeyAscii)
End Sub




================================
===========================================================

VB-31 : Round a given number (to the nearest one)

Write an event procedure to round a value to ceil(up),floor(down) or near to another value.All the values should be displayed in the corresponding text boxes once the submit button is pressed,Design a good interface with appropriate controls.



A)    Program Design : 






(B) Property(Controls Used) :
  1. Label1  :  Caption - Enter a number
  2. Label2  :  Caption - Rounded to Ceil
  3. Label3  :  Caption - Rounded toFloor
  4. Label4  :  Caption - Rounded to 2 digit
  5. TextBox1 : Text Property - (Blank)
  6. TextBox2: Text Property - (Blank)
  7. TextBox3 : Text Property - (Blank)
  8. TextBox4 : Text Property - (Blank)
  9. Command Button : Caption - Round
C) Attaching Code to the Object :




Private Sub Command1_Click()
Dim num As Single
num = Val(Text1.Text)
If num = 0 Then
    MsgBox "Enter a non-zero number only"
    Text1.SetFocus
    GoTo endp
Else
    Text2.Text = Int(num)
    If Int(num) = num Then
    Text2.Text = num
Else
    Text3.Text = Int(num) + 1
End If
End If
Text4.Text = Math.Round(num, 2)
endp:
End Sub







































Output :
Enter a number    :   3.256
Click Round
Rounded to Ceil : 3
Rounded to Floor :4
Rounded to2 digit :3.26

================================
===========================================================

VB-30 : Generate a Bill for a department store

Refer
Generate a bill for a ready-made garment store...


      • ====================================================================
        Back to Home   &  VB
    ===========================================================