home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sams Cobol 24 Hours
/
Sams_Cobol_24_Hours.iso
/
Cobol32
/
PowerOCX
/
bsrtocx.z
/
sample1.frm
< prev
next >
Wrap
Text File
|
1997-05-14
|
14KB
|
451 lines
VERSION 4.00
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "PowerBSORT OCX Sample"
ClientHeight = 3795
ClientLeft = 1695
ClientTop = 1500
ClientWidth = 5895
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 4215
Icon = "sample1.frx":0000
Left = 1635
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4188.491
ScaleMode = 0 'User
ScaleWidth = 6007.124
Top = 1140
Width = 6015
Begin VB.CommandButton Command1
Caption = "Sort"
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
Height = 360
Left = 2353
TabIndex = 12
Top = 3363
Width = 1188
End
Begin VB.CommandButton Command2
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
Height = 447
Left = 4823
TabIndex = 6
Top = 108
Width = 956
End
Begin VB.Frame Frame5
Caption = "Return code"
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
Height = 552
Left = 2340
TabIndex = 1
Top = 0
Width = 2244
Begin VB.Label la_Detail
Caption = "Detail:"
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
Height = 252
Left = 1080
TabIndex = 4
Top = 240
Width = 612
End
Begin VB.Label la_Error
Caption = "Error:"
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
Height = 255
Left = 120
TabIndex = 2
Top = 240
Width = 495
End
Begin VB.Label la_DetailVal
Caption = "Label4"
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
Height = 252
Left = 1680
TabIndex = 5
Top = 240
Width = 432
End
Begin VB.Label la_ErrorVal
Caption = "Label4"
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
Height = 255
Left = 600
TabIndex = 3
Top = 240
Width = 495
End
End
Begin VB.Frame Frame1
Caption = "Input Data"
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
Height = 2291
Left = 120
TabIndex = 8
Top = 960
Width = 2603
Begin VB.ListBox List1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Fixedsys"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1860
Left = 120
TabIndex = 9
Top = 240
Width = 2415
End
End
Begin VB.Frame Frame2
Caption = "Output Data"
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
Height = 2291
Left = 3180
TabIndex = 14
Top = 960
Width = 2603
Begin VB.ListBox List2
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Fixedsys"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1860
Left = 120
TabIndex = 15
Top = 240
Width = 2415
End
End
Begin VB.CommandButton Command3
Caption = "View"
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
Height = 360
Left = 780
TabIndex = 10
Top = 3360
Width = 1188
End
Begin VB.TextBox InputFileText
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
Height = 288
HelpContextID = 1340
Left = 118
TabIndex = 7
Text = "Text1"
Top = 651
Width = 2603
End
Begin VB.TextBox OutputFileText
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
Height = 288
HelpContextID = 1390
Left = 3176
TabIndex = 13
Text = "Text1"
Top = 651
Width = 2603
End
Begin VB.CommandButton Command4
Caption = "View"
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
Height = 360
Left = 4000
TabIndex = 16
Top = 3363
Width = 1188
End
Begin PowerBSORT_Lib.PowerBSORT PowerBSORT1
Left = 120
Top = 3360
_Version = 65536
_ExtentX = 741
_ExtentY = 741
_StockProps = 0
End
Begin VB.Label Label1
Caption = "Sample"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 24
Charset = 0
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 624
Left = 240
TabIndex = 0
Top = 0
Width = 1896
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "->"
Height = 300
Left = 2820
TabIndex = 11
Top = 1980
Width = 228
End
End
Attribute VB_Name = "Form1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
Const col_BackNormal = &HFFFFFF
Const col_TextNormal = &H0
Const col_BackOK = &HFF0000
Const col_TextOK = &HFFFFFF
Const col_BackErr = &HFF
Const col_TextErr = &HFFFFFF
Private Sub AfterAction()
Dim ErrCode, ErrDetail As Long
Dim col_Back, col_Text As Long
ErrCode = PowerBSORT1.ErrorCode
ErrDetail = PowerBSORT1.ErrorDetail
la_ErrorVal.Caption = CStr(ErrCode)
la_DetailVal.Caption = CStr(ErrDetail)
If ErrCode = 0 Then
col_Back = col_BackOK
col_Text = col_TextOK
Else
col_Back = col_BackErr
col_Text = col_TextErr
End If
la_Error.ForeColor = col_Text
la_Error.BackColor = col_Back
la_ErrorVal.ForeColor = col_Text
la_ErrorVal.BackColor = col_Back
la_Detail.ForeColor = col_Text
la_Detail.BackColor = col_Back
la_DetailVal.ForeColor = col_Text
la_DetailVal.BackColor = col_Back
End Sub
Private Sub BeforeAction()
la_Error.ForeColor = col_TextNormal
la_Error.BackColor = col_BackNormal
la_ErrorVal.ForeColor = col_TextNormal
la_ErrorVal.BackColor = col_BackNormal
la_Detail.ForeColor = col_TextNormal
la_Detail.BackColor = col_BackNormal
la_DetailVal.ForeColor = col_TextNormal
la_DetailVal.BackColor = col_BackNormal
End Sub
Private Sub Command1_Click()
BeforeAction
' --- bigin ---
PowerBSORT1.InputFiles = InputFileText.Text
PowerBSORT1.InputFileType = 0
PowerBSORT1.OutputFile = OutputFileText.Text
PowerBSORT1.OutputFileType = 0
PowerBSORT1.MaxRecordLength = 100
PowerBSORT1.DisposalNumber = 0 ' Sort
PowerBSORT1.Action
' --- end ---
AfterAction
If PowerBSORT1.ErrorCode = 0 Then
Command4.Enabled = True
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub InFileView()
Dim fileNam, lin As String
Dim fileNum, lineCount As Long
fileNam = InputFileText.Text
fileNum = FreeFile
On Error GoTo IopenError
Open fileNam For Input As #fileNum
List1.Clear
lineCount = 0
Do Until EOF(fileNum)
Line Input #fileNum, lin$
lineCount = lineCount + 1
If lineCount > 100 Then Exit Do
List1.AddItem lin$
Loop
Close #fileNum
Exit Sub
IopenError:
Exit Sub
End Sub
Private Sub OutFileView()
Dim fileNam, lin As String
Dim fileNum, lineCount As Long
fileNam = OutputFileText.Text
fileNum = FreeFile
On Error GoTo OopenError
Open fileNam For Input As #fileNum
List2.Clear
lineCount = 0
Do Until EOF(fileNum)
Line Input #fileNum, lin$
lineCount = lineCount + 1
If lineCount > 100 Then Exit Do
List2.AddItem lin$
Loop
Close #fileNum
Exit Sub
OopenError:
Exit Sub
End Sub
Private Sub Command3_Click()
InFileView
End Sub
Private Sub Command4_Click()
OutFileView
End Sub
Private Sub Form_Load()
App.HelpFile = "..\program\psocx.hlp"
InputFileText.Text = "data\sortin.txt"
OutputFileText.Text = "data\sortout.txt"
la_ErrorVal.Caption = ""
la_DetailVal.Caption = ""
End Sub
Private Sub Form_Unload(Cancel As Integer)
Unload Me
End Sub