Private Sub enter_Click()
On Error GoTo errHandler
' If mDirty = True Then 'mdirty mean weather the byte have been changed or not
' Dim tmp
' tmp = MsgBox("Byte(s) changed; save to file", vbYesNoCancel + vbQuestion)
' If tmp = vbCancel Then
'Exit Sub
'ElseIf tmp = vbYes Then
' cmdSave_Click
'If gCancel Then
'Exit Sub
'End If
' End If
' End If
Dim mHandle
'Set gcdg = CommonDialog1
'gcdg.Flags = cdlOFNFileMustExist
'gcdg.FileName = ""
'gcdg.CancelError = True
' If gcdg.FileName = " " Then
' Exit Sub
'End If
mHandle = FreeFile
Open "a:\bonding.bin " For Binary As mHandle
'Open gcdg.FileName For Binary As #mHandle
mFileSize = LOF(mHandle)
If mFileSize = 0 Then
Close mHandle
MsgBox "Empty file"
Exit Sub
End If
Screen.MousePointer = vbCross
ReDim arrByte(1 To mFileSize)
Get #mHandle, , arrByte
Close mHandle
rtbChr.Text = ""
rtbChr.LoadFile gcdg.FileName
lblFileSize.Caption = CStr(mFileSize) & "bytes"
lblFileSpec.Caption = "A:\bonding.bin"
txbEdit.Move 0, 0
pageStart = 1
pageEnd = mPageSize
ShowPage False
mDirty = False
'Ensure to start from View mode again
' imgEdit.Appearance = 0
' imgEdit.ToolTipText = "View Mode is On"
' imgOverWriteOn.Visible = False
' imgOverwriteOff.Visible = False
txbEdit.Visible = False
'setButtons True
PicHexDisp.SetFocus
Screen.MousePointer = vbDefault
Exit Sub
errHandler:
If Err.Number <> 32755 Then
Screen.MousePointer = vbDefault
lblFileSize.Caption = ""
lblFileSpec.Caption = ""
rtbChr.Text = ""
PicHexDisp.Picture = LoadPicture()
PicChrDisp.Picture = LoadPicture()
picOffSet1.Picture = LoadPicture()
PicOffSet2.Picture = LoadPicture()
' setButtons False
ErrMsgProc "cmdFileOpen_Click"
'form_success.Show
End If
End Sub
i declare mfilesize as the DIm mFileSize as long.When i use this coding
Private Sub cmdscan_Click()
Const a As Byte = 4
Const b As Byte = &HFF
Dim I As Long
Dim AnyChanged As Boolean
Dim changeMade As Boolean
Dim value As Byte
Dim x
Dim tmp As String
For I = 1 To mfilesize Step 6
AnyChanged = False
Debug.Print "Before : "; Hex$(arrByte(I)); " "; Hex$(arrByte(I + 1)); " "; Hex$(arrByte(I + 2)); _
" "; Hex$(arrByte(I + 3)); " "; Hex$(arrByte(I + 4)); " "; Hex$(arrByte(I + 5))
' Print HexByte2Char(I)
If arrByte(I) <> a Then
arrByte(I) = a
value = a
x = HexByte2Char(value)
tmp = Format$(x, "@@")
'PicOffSet2.CurrentX = x * Stdw1
Debug.Print tmp;
changeMade = True
End If
If arrByte(I + 1) <> b Then
arrByte(I + 1) = b
changeMade = True
End If
If changeMade Then
AnyChanged = True
Debug.Print "After : "; Hex$(arrByte(I)); " "; Hex$(arrByte(I + 1)); " "; Hex$(arrByte(I + 2)); _
" "; Hex$(arrByte(I + 3)); " "; Hex$(arrByte(I + 4)); " "; Hex$(arrByte(I + 5)); _
" <--- Corrected"
End If
Debug.Print
Next
End Sub
Actualy this program cant read the file untol mfilesize until eof file.why?
when i executed this coding the program cant work.when i execute this the program stop and come out with error the program is responding. WHY IT IS HAPPENING.is it the vb got limitation to read data or my datatype is wrong