VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{E0D30636-0F87-47D5-B501-08A4FFAC604E}#1.0#0"; "OSENXPSUITE2005.OCX"
Begin VB.Form frmmatrixlatest
BackColor = &H00D8E9EC&
BorderStyle = 0 'None
ClientHeight = 4680
ClientLeft = 0
ClientTop = 0
ClientWidth = 6270
KeyPreview = -1 'True
LinkTopic = "Form2"
ScaleHeight = 312
ScaleMode = 3 'Pixel
ScaleWidth = 418
StartUpPosition = 3 'Windows Default
Begin osenxpsuite2005.OsenXPForm OsenXPForm1
Align = 1 'Align Top
Height = 450
Left = 0
TabIndex = 9
Top = 0
Width = 6270
_ExtentX = 11060
_ExtentY = 794
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Trebuchet MS"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = ""
TitleTop = 7
BorderStyle = 1
UseDefaultTheme = 0 'False
End
Begin osenxpsuite2005.OsenXPFrame OsenXPFrame1
Height = 1215
Left = 1200
TabIndex = 8
Top = 3360
Width = 3495
_ExtentX = 6165
_ExtentY = 2143
Caption = "Solution"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BorderColor = 12570832
Begin osenxpsuite2005.OsenXPButton cmdRR
Height = 375
Left = 120
TabIndex = 4
Top = 240
Width = 1575
_ExtentX = 2778
_ExtentY = 661
Caption = "Row Reduction"
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MCOL = 16711935
MPTR = 0
MICON = "matrixlatest.frx":0000
UMCOL = -1 'True
OffsetLeft = 0
OffsetTop = 0
XPBlendPicture = -1 'True
GradientColor = -1 'True
GradientColor1 = 16777215
GradientColor2 = 14854529
End
Begin osenxpsuite2005.OsenXPButton cmdCR
Height = 375
Left = 1800
TabIndex = 5
Top = 240
Width = 1575
_ExtentX = 2778
_ExtentY = 661
Caption = "Column Reduction"
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MCOL = 16711935
MPTR = 0
MICON = "matrixlatest.frx":001C
UMCOL = -1 'True
OffsetLeft = 0
OffsetTop = 0
XPBlendPicture = -1 'True
GradientColor = -1 'True
GradientColor1 = 16777215
GradientColor2 = 14854529
End
Begin osenxpsuite2005.OsenXPButton cmdscan
Height = 375
Left = 120
TabIndex = 6
Top = 720
Width = 1575
_ExtentX = 2778
_ExtentY = 661
Caption = "Matrix Scanner"
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MCOL = 16711935
MPTR = 0
MICON = "matrixlatest.frx":0038
UMCOL = -1 'True
OffsetLeft = 0
OffsetTop = 0
XPBlendPicture = -1 'True
GradientColor = -1 'True
GradientColor1 = 16777215
GradientColor2 = 14854529
End
Begin osenxpsuite2005.OsenXPButton cmdend
Height = 375
Left = 1800
TabIndex = 7
Top = 720
Width = 1575
_ExtentX = 2778
_ExtentY = 661
Caption = "Exit"
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MCOL = 16711935
MPTR = 0
MICON = "matrixlatest.frx":0054
UMCOL = -1 'True
OffsetLeft = 0
OffsetTop = 0
XPBlendPicture = -1 'True
GradientColor = -1 'True
GradientColor1 = 16777215
GradientColor2 = 14854529
End
End
Begin MSFlexGridLib.MSFlexGrid Matrix
Height = 2295
Index = 0
Left = 120
TabIndex = 0
Top = 480
Width = 6015
_ExtentX = 10610
_ExtentY = 4048
_Version = 393216
BackColorBkg = 14215660
End
Begin MSFlexGridLib.MSFlexGrid Matrix
Height = 2295
Index = 1
Left = 120
TabIndex = 1
Top = 480
Visible = 0 'False
Width = 6015
_ExtentX = 10610
_ExtentY = 4048
_Version = 393216
BackColorBkg = 14215660
End
Begin MSFlexGridLib.MSFlexGrid Matrix
Height = 2295
Index = 2
Left = 120
TabIndex = 2
Top = 480
Visible = 0 'False
Width = 6015
_ExtentX = 10610
_ExtentY = 4048
_Version = 393216
BackColorBkg = 14215660
End
Begin VB.Label lblAns
AutoSize = -1 'True
BackColor = &H00D8E9EC&
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 1320
TabIndex = 3
Top = 3000
Width = 45
End
End
Attribute VB_Name = "frmmatrixlatest"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public i As Integer
Public j As Integer
Dim k As Integer
Dim minc As Integer
Dim mc1(50) As Integer
Dim min As Integer
Dim mr1(50) As Integer
Dim a(50, 50) As Variant
Public m As Integer
Public n As Integer
Dim ans(20) As Integer
Dim temp As Variant
Dim cnt As Integer
Dim count1 As Integer
Dim t(50, 50) As Double
Public total As Integer
Dim p(50, 50) As Double
Private Sub Form_Load()
frmmatrixlatest.Top = 2000
frmmatrixlatest.Left = 2500
Matrix(0).Rows = totalrows
Matrix(0).Cols = totalcols
Matrix(1).Rows = totalrows
Matrix(1).Cols = totalcols
Matrix(2).Rows = totalrows
Matrix(2).Cols = totalcols
End Sub
Private Sub imgclose_Click()
End
End Sub
Public Sub RowR()
If maxmin = "M" Or maxmin = "m" Then
For j = 1 To Matrix(0).Rows - 1
For i = 1 To Matrix(0).Cols - 1
Matrix(0).TextMatrix(j, i) = Matrix(0).TextMatrix(j, i) * -1
Next
Next
End If
k = 1
For j = 1 To Matrix(0).Rows - 1
min = Val(Matrix(0).TextMatrix(j, 1))
For i = 2 To Matrix(0).Cols - 1
If Val(Matrix(0).TextMatrix(j, i)) < min Then
min = Val(Matrix(0).TextMatrix(j, i))
End If
Next
mr1(k) = min
k = k + 1
Next
k = 1
For j = 1 To Matrix(0).Rows - 1
For i = 1 To Matrix(0).Cols - 1
Matrix(1).TextMatrix(j, i) = (Val(Matrix(0).TextMatrix(j, i))) - mr1(k)
Next
k = k + 1
Next
End Sub
Private Sub cmdRR_Click()
Call RowR
Matrix(0).Visible = False
Matrix(1).Visible = True
cmdCR.Enabled = True
cmdRR.Enabled = False
End Sub
Public Sub ColR()
k = 1
For i = 1 To Matrix(1).Cols - 1
minc = Val(Matrix(1).TextMatrix(1, i))
For j = 2 To Matrix(1).Rows - 1
If Val(Matrix(1).TextMatrix(j, i)) < minc Then
minc = Val(Matrix(1).TextMatrix(j, i))
End If
Next
mc1(k) = minc
k = k + 1
Next
k = 1
For i = 1 To Matrix(0).Cols - 1
For j = 1 To Matrix(0).Rows - 1
Matrix(2).TextMatrix(j, i) = Val((Matrix(1).TextMatrix(j, i))) - mc1(k)
Next
k = k + 1
Next
End Sub
Private Sub cmdCR_Click()
Call ColR
Matrix(0).Visible = False
Matrix(1).Visible = False
Matrix(2).Visible = True
cmdscan.Enabled = True
cmdCR.Enabled = False
End Sub
Public Sub Scaner()
scanning:
For i = 1 To Matrix(2).Rows - 1
For j = 1 To Matrix(2).Cols - 1
a(i, j) = Matrix(2).TextMatrix(i, j)
Next
Next
''For row scanning
count1 = 0: total = 0
check:
For i = 1 To Matrix(2).Rows - 1
cnt = 0
For j = 1 To Matrix(2).Cols - 1
If a(i, j) = 0 Then
MsgBox "Zero (0) is in :- " & vbCrLf & _
"Row(s) --- Column(s)." & vbCrLf & _
" " & i & " --- " & j
'MsgBox i & "---" & j
cnt = cnt + 1
If cnt = 1 Then
m = i
n = j
End If
End If
Next
If cnt = 1 Then
ans(m) = n
count1 = count1 + 1
For m = 1 To Matrix(2).Rows
a(m, n) = "Y"
Next
End If
Next
'add coding for count = 5 zeros
''For column scanning
For j = 1 To Matrix(2).Cols - 1
cnt = 0
For i = 1 To Matrix(2).Rows - 1
If a(i, j) <> "Y" Then
GoTo checkcont
End If
Next
GoTo nextj
checkcont:
For i = 1 To Matrix(2).Rows - 1
If a(i, j) = 0 Then
MsgBox "Zero (0) is in :- " & vbCrLf & _
"Row(s) --- Column(s)." & vbCrLf & _
" " & i & " --- " & j
'MsgBox i & "---" & j
cnt = cnt + 1
If cnt = 1 Then
m = i
n = j
End If
End If
Next
If cnt = 1 Then
count1 = count1 + 1
ans(m) = n
For n = 1 To Matrix(2).Rows - 1
If a(m, n) = "Y" Then
a(m, n) = "N"
Else
a(m, n) = "Y"
End If
Next
End If
nextj:
Next
'add coding for count = 5 zeros
For i = 1 To Matrix(2).Rows - 1
For j = 1 To Matrix(2).Cols - 1
If a(i, j) <> "Y" And a(i, j) <> "N" Then
temp = a(i, j)
Exit For
End If
Next
Next
For i = 1 To Matrix(2).Rows - 1
For j = 1 To Matrix(2).Cols - 1
If a(i, j) = 0 Then
GoTo check
ElseIf count1 = Matrix(2).Rows - 1 Then
GoTo End1
Else
If a(i, j) <> "Y" And a(i, j) <> "N" Then
If a(i, j) <= temp Then temp = a(i, j)
End If
End If
Next
Next
''For subtraction and addition for undeleted and intersect value
For i = 1 To Matrix(2).Rows - 1
For j = 1 To Matrix(2).Cols - 1
If a(i, j) = "N" Then
t(i, j) = Val(Matrix(2).TextMatrix(i, j)) + Val(temp)
End If
If a(i, j) <> "Y" And a(i, j) <> "N" Then
t(i, j) = Val(Matrix(2).TextMatrix(i, j)) - Val(temp)
End If
Next
Next
''Go to step-3
GoTo scanning
End1:
For m = 1 To Matrix(2).Cols - 1
For n = 1 To Matrix(2).Rows - 1
If (ans(m) = n) Then
total = Val(total) + Val(Matrix(0).TextMatrix(n, m))
End If
Next
Next
lblAns.Caption = "ANS -->" & " " & total
End Sub
Private Sub cmdscan_Click()
Call Scaner
cmdend.Enabled = True
cmdscan.Enabled = False
End Sub
Private Sub cmdend_Click()
End
End Sub
Private Sub Matrix_KeyPress(index As Integer, KeyAscii As Integer)
'Enters keystrokes into the cells
If KeyAscii = 8 Then 'Did the user press backspace?
If Len(Matrix(index).Text) > 0 Then 'Is there text in the box?
Matrix(index).Text = Left((Matrix(index).Text), _
Len(Matrix(index).Text) - 1) 'Delete the last character
End If
Else
'Check to see if there isn't a decimal (".") already entered
Dim Count As Integer 'temporary loop variable
Dim NoDot As Boolean 'There is no decimal in the cell if this is true
NoDot = True 'initial value
If Len(Matrix(index).Text) > 0 Then 'it doesn't need to do this if < 0
For Count = 1 To Len(Matrix(index).Text)
If Mid(Matrix(index).Text, Count, 1) = "." Then
NoDot = False
End If
Next Count
End If
'Input a "-" only if it is the first character
If Len(Matrix(index).Text) = 0 And (Chr$(KeyAscii) = "-") Then
Matrix(index).Text = Matrix(index).Text + Chr$(KeyAscii)
End If
'Make sure an integer number is input
If (Len(Matrix(index).Text) < 9) And _
IsNumeric(Chr$(KeyAscii)) Or (Chr$(KeyAscii) = ".") Then
'Make sure there aren't two decimals
If NoDot Or (Chr$(KeyAscii) <> ".") Then
'Insert the number/decimal
Matrix(index).Text = Matrix(index).Text + Chr$(KeyAscii)
End If
End If
End If
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
'27 for Escape
If KeyAscii = 27 Then End
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendKeys "{tab}"
End Sub