updated code
this is my new code...almost near completion but i dunno why the last If loop in the button click event is nt workin properly.its supposed to write stuff 17 times...its jus doin it once
Imports System.IO
Public Class Form1
Inherits System.Windows.Forms.Form
Public oXL As Excel.Application
Public oWB As Excel.Workbook
Public oSheet As Excel.Worksheet
Public oRng As Excel.Range
Dim buffer As New ArrayList
Dim nom As Integer = 27
Dim min As Integer = 28
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(112, 192)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'Form2
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 272)
Me.Controls.Add(Me.Button1)
Me.Name = "Form2"
Me.Text = "Form2"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim fs As FileStream = New FileStream("C:\Arch.bin", FileMode.OpenOrCreate)
Dim num As Byte
Dim n As String
Dim endOfStream As Boolean
Dim r As System.IO.BinaryReader = New System.IO.BinaryReader(fs)
While (Not endOfStream)
Try
num = r.ReadByte()
n = Hex(CInt(num))
If n = "20" Then
n = "00"
buffer.Add
ElseIf n.Length = 1 Then
n = "0" + n
buffer.Add
Else
buffer.Add
End If
Catch ex As EndOfStreamException
endOfStream = True
End Try
End While
If buffer.Item(4) = "00" Then
buffer.Item(4) = "20"
End If
Call LoadExcel()
Dim row As Integer = 2
If nom <> buffer.Count Then
If (min - 28) / 6 <> CInt("&H" & buffer.Item(nom)) Then
Call WriteXL(row, min)
row = row + 1
min = min + 6
Else
End If
Else
End If
End Sub
Sub LoadExcel()
oXL = CreateObject("Excel.Application")
oXL.Visible = True
' Get a new workbook.
oWB = oXL.Workbooks.Add
oSheet = oWB.ActiveSheet
' Start Excel and get Application object.
' Add table headers going cell by cell.
oSheet.Cells(1, 1).Value = "Record header"
oSheet.Cells(1, 2).Value = "Finger header"
oSheet.Cells(1, 3).Value = "Minutia type + X"
oSheet.Cells(1, 4).value = "Y"
oSheet.Cells(1, 5).value = "Angle"
oSheet.Cells(1, 6).Value = "Image quality"
oSheet.Cells(1, 7).value = "Private Data Area"
oSheet.Cells(2, 1).Value = "0x" + buffer.Item(0) + buffer.Item(1) + buffer.Item(2) + buffer.Item(3) + buffer.Item(4) + buffer.Item(5) + buffer.Item(6) + buffer.Item(7) + buffer.Item(8) + buffer.Item(9) + buffer.Item(10) + buffer.Item(11) + buffer.Item(12) + buffer.Item(13) + buffer.Item(14) + buffer.Item(15) + buffer.Item(16) + buffer.Item(17) + buffer.Item(18) + buffer.Item(19) + buffer.Item(20) + buffer.Item(21) + buffer.Item(22) + buffer.Item(23)
oSheet.Cells(2, 2).value = "0x" + buffer.Item(24) + buffer.Item(25) + buffer.Item(26) + buffer.Item(27)
End Sub
Sub WriteXL(ByVal row As Integer, ByVal min As Integer)
oSheet.Range("C" & row).Value = "0x" + buffer.Item(min) + buffer.Item(min + 1)
oSheet.Range("D" & row).Value = "0x" + buffer.Item(min + 2) + buffer.Item(min + 3)
oSheet.Range("E" & row).Value = "0x" + buffer.Item(min + 4)
oSheet.Range("F" & row).Value = "0x" + buffer.Item(min + 5)
End Sub
End Class