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 frmmatrixnew
BackColor = &H00D8E9EC&
BorderStyle = 0 'None
ClientHeight = 5340
ClientLeft = 0
ClientTop = 0
ClientWidth = 6270
KeyPreview = -1 'True
LinkTopic = "Form2"
ScaleHeight = 356
ScaleMode = 3 'Pixel
ScaleWidth = 418
StartUpPosition = 3 'Windows Default
Begin osenxpsuite2005.OsenXPLabel lblAns
Height = 255
Left = 3600
TabIndex = 11
Top = 2880
Width = 300
_ExtentX = 529
_ExtentY = 450
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
FontBold = -1 'True
Caption = "a"
ForeColor = 0
BackStyle = 0
End
Begin osenxpsuite2005.OsenXPLabel Label3
Height = 255
Left = 1920
TabIndex = 10
Top = 3240
Width = 300
_ExtentX = 529
_ExtentY = 450
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
FontBold = -1 'True
Caption = "t"
ForeColor = 0
BackStyle = 0
End
Begin osenxpsuite2005.OsenXPLabel lblTime
Height = 255
Left = 1920
TabIndex = 9
Top = 2880
Width = 300
_ExtentX = 529
_ExtentY = 450
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
FontBold = -1 'True
Caption = "t"
ForeColor = 0
BackStyle = 0
End
Begin osenxpsuite2005.OsenXPLabel Label2
Height = 255
Left = 1440
TabIndex = 8
Top = 3240
Width = 300
_ExtentX = 529
_ExtentY = 450
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
FontBold = -1 'True
Caption = "o"
ForeColor = 0
BackStyle = 0
End
Begin osenxpsuite2005.OsenXPLabel lblOp
Height = 255
Left = 1440
TabIndex = 7
Top = 2880
Width = 300
_ExtentX = 529
_ExtentY = 450
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
FontBold = -1 'True
Caption = "o"
ForeColor = 0
BackStyle = 0
End
Begin osenxpsuite2005.OsenXPLabel Label1
Height = 255
Left = 960
TabIndex = 6
Top = 3240
Width = 300
_ExtentX = 529
_ExtentY = 450
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
FontBold = -1 'True
Caption = "j"
ForeColor = 0
BackStyle = 0
End
Begin osenxpsuite2005.OsenXPLabel lblJob
Height = 255
Left = 960
TabIndex = 5
Top = 2880
Width = 300
_ExtentX = 529
_ExtentY = 450
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
FontBold = -1 'True
Caption = "j"
ForeColor = 0
BackStyle = 0
End
Begin osenxpsuite2005.OsenXPForm OsenXPForm1
Align = 1 'Align Top
Height = 450
Left = 0
TabIndex = 4
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 = 1335
Left = 1320
TabIndex = 3
Top = 3720
Width = 3495
_ExtentX = 6165
_ExtentY = 2355
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 = 12
Top = 360
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 = "matrixnew.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 = 13
Top = 360
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 = "matrixnew.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 = 14
Top = 840
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 = "matrixnew.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 = 15
Top = 840
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 = "matrixnew.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
End
Attribute VB_Name = "frmmatrixnew"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'This for has certain problem. So you
'can go through another form provided.
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 Double
Public m As Integer
Public n As Integer
Dim ans(20) As Integer
Dim temp As Double
Dim cnt As Integer
Public count1 As Integer
Dim t(50, 50) As Double
Public total As Integer
Dim p(50, 50) As Double
Private Sub Form_Load()
frmmatrixnew.Top = 2000
frmmatrixnew.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
count1 = 0
total = 0
End Sub
Private Sub imgclose_Click()
End
End Sub
Public Sub RowR()
k = 1
For i = 1 To Matrix(0).Rows - 1
min = Val(Matrix(0).TextMatrix(i, 1))
For j = 1 To Matrix(0).Cols - 1
p(i, j) = Val(Matrix(0).TextMatrix(i, j))
If min > Val(Matrix(0).TextMatrix(i, j)) Then
min = Val(Matrix(0).TextMatrix(i, j))
End If
Next
mr1(k) = min
k = k + 1
Next
k = 1
For i = 1 To Matrix(0).Rows - 1
For j = 1 To Matrix(0).Cols - 1
Matrix(1).TextMatrix(i, j) = (Val(Matrix(0).TextMatrix(i, j))) - mr1(k)
t(i, j) = (Val(Matrix(0).TextMatrix(i, j))) - 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 j = 1 To Matrix(1).Rows - 1
minc = Val(Matrix(1).TextMatrix(j, 1))
For i = 1 To Matrix(1).Cols - 1
If minc > Matrix(1).TextMatrix(i, j) Then
minc = Val(Matrix(1).TextMatrix(i, j))
End If
Next
mc1(k) = minc
k = k + 1
Next
k = 1
For i = 1 To Matrix(1).Rows - 1
For j = 1 To Matrix(1).Cols - 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) = Val(Matrix(1).TextMatrix(i, j))
Next
GoTo check
Next
''For row scanning
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
cnt = cnt + 1
End If
Next
If cnt = 1 Then
count1 = count1 + 1
For m = 1 To Matrix(2).Rows - 1
For n = 1 To Matrix(2).Cols - 1
If a(m, n) = 0 Then
ans(m) = n
For k = 1 To Matrix(2).Rows - 1
a(k, n) = 0.9999
Next
End If
Next
Next
End If
Next
''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) = 0 Then
cnt = cnt + 1
End If
Next
If cnt = 1 Then
For m = 1 To Matrix(2).Cols - 1
For n = 1 To Matrix(2).Rows - 1
If a(n, m) = 0 Then
ans(n) = m
For k = 1 To Matrix(2).Rows - 1
If a(k, m) = 0.9999 Then
a(k, m) = -0.9999
Else
a(k, m) = 0.9999
End If
Next
End If
Next
Next
End If
Next
For i = 1 To Matrix(2).Rows - 1
For j = 1 To Matrix(2).Cols - 1
If a(i, j) <> 0.9999 And a(i, j) <> -0.9999 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) <> 0.9999 And a(i, j) <> -0.9999 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) = -0.9999 Then
t(i, j) = Val(Matrix(1).TextMatrix(i, j)) + temp
End If
If a(i, j) <> 0.9999 And a(i, j) <> -0.9999 Then
t(i, j) = Val(Matrix(1).TextMatrix(i, j)) - temp
End If
Next
Next
''Go to step-3
GoTo scanning
End1:
lblJob.Caption = "Job"
lblOp.Caption = "Op"
lblTime.Caption = "Time"
For m = 1 To Matrix(2).Cols - 1
Label1.Caption = m
Label2.Caption = ans(m)
For n = 1 To Matrix(2).Rows - 1
If ans(m) = n Then
total = total + p(m, n)
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