473,513 Members | 2,425 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mfile size error

kirubagari
158 New Member
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
Jul 13 '07 #1
1 1154
Killer42
8,435 Recognized Expert Expert
You need to be specific about the details of the error which is reported, and the line where it is reported.
Jul 13 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
8209
by: Robin Tucker | last post by:
As I had real problems working my head around sp_spaceused, I've written an SP to do it (I also noted a lot of questions about this when "searching"). Pass in a database name and it will return the...
1
2227
by: BTHOMASinOHIO | last post by:
I am confussed on what the heck is going on ?! I have an HTML INPUT File Box on an Email Piece of an application. I know that File Size is set to 4MB in the WebConfig File and that is fine, but I...
40
3875
by: madireddy | last post by:
Hi, Inside a program how do i find out what size has been allocated to pointer using malloc. eg... int *p; p=(int*)malloc(1024*sizeof(int)); now how do find how much has been allocated to p?...
3
12719
by: spielmann | last post by:
Hello I want to change the scrollbar size of windows, How can I do that with vb.net I have find this in VB6 but how can we convert simply this code. thx
7
43841
by: carterweb | last post by:
This is how I do it now. 1. Determine the dimensions of the rectangle. 2. Set a my font size to a fixed maximum size. 3. Apply the font my string and measure the string using the graphics...
1
5438
by: chrisj | last post by:
I'm using freeASPupload and got some assistance integrating to a Member script. It works successfully. In this modified version there are two groups that use this upload script. Members of one...
10
6933
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
13
379
by: JOYCE | last post by:
Please help me,I don't know where the error is.The following is my programming. #include<stdio.h> #define SIZE 99 void mean (const int answer); void median(int answer); void mode(int...
11
5556
by: xenoix | last post by:
hey there, im reasonably new to C# and im currently writing a backup application which im using as a learning resource. My PC :- Visual Studio 2005 .NET Framework 2 Component Factory Krypton...
0
7166
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7386
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7534
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5689
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5094
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3236
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3226
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1601
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
459
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.