Project Detail

VB programming tutor 1 hour  

VB programming tutor 1 hour is project number 189600
posted at Freelancer.com. Click here to post your own project.

 

| More Free Trial For New Buyers
 

Status:

Selected Providers: wsh2

Budget: $30-100

Created: 10/26/2007 at 3:00 EDT

Bid Count: 16

Average Bid:
N/A

10/29/2007 at 3:00 EDT

Project Creator: willie108
Employer Rating: 10/1010/1010/1010/1010/1010/1010/1010/1010/1010/10 (5 reviews)

Bid On This Project
 

Description

I have a fairly simple program in VB. I would like someone to spend an hour explaining how it works. I used to write some VBA macros but I am not familiar with some of the stuff in this program.
The input for the program is a csv file and the output will also be a csv file. I will paste it in below.
Thanks!
Public Class Form1
Dim finput As String = "input.csv"
Dim groupdata As String = "groupdata.csv"
Dim output As String = "output.csv"
Dim data(205, 27) As Double
Dim va(205), vb(205), v As Double
Dim gr(205), g As Byte

Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
inp()
run()
out()
End Sub

Public Sub run()
Dim a, b As Integer
Dim tmp As Double

For a = 1 To 205
va(a) = calaver(a, gr(a))
For b = 1 To g
If b <> gr(a) Then
tmp = calaver(a, b)
If tmp < vb(a) Or vb(a) = 0 Then
vb(a) = tmp
End If
End If
Next
v = v + (vb(a) - va(a)) / max(vb(a), va(a))
Next
v = v / 205
End Sub

Function max(ByVal v1 As Double, ByVal v2 As Double) As Double
If v1 >= v2 Then
max = v1
Else
max = v2
End If
End Function

Function calaver(ByVal fr As Integer, ByVal ds As Integer) As Double
Dim a, b, n As Integer
Dim tmpv, result As Double

result = 0
n = 0
For a = 1 To 205
If gr(a) = ds And a <> fr Then
tmpv = 0
For b = 1 To 27
tmpv = tmpv + (data(fr, b) - data(a, b)) ^ 2
Next
tmpv = tmpv ^ 0.5
n = n + 1
result = result + tmpv
End If
Next
result = result / n
calaver = result
If n = 0 Then calaver = 0

End Function

Public Sub inp()
Dim fn, a, b As Integer

fn = FreeFile()

FileOpen(fn, finput, OpenMode.Input)
For a = 1 To 205
For b = 1 To 27
Input(fn, data(a, b))
Next
Next
FileClose(fn)

FileOpen(fn, groupdata, OpenMode.Input)
For a = 1 To 205
Input(fn, gr(a))
If gr(a) > g Then
g = gr(a)
End If
Next
FileClose(fn)
End Sub

Public Sub out()
Dim fn, a As Integer

fn = FreeFile()
FileOpen(fn, output, OpenMode.Output)
For a = 1 To 205
WriteLine(fn, va(a), vb(a), (vb(a) - va(a)) / max(vb(a), va(a)))
Next
Write(fn, v)
FileClose(fn)
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub
End Class

Messages Posted:0 View project clarification board Post message on project clarification board

Bid On This Project
 

If you are the project creator or one of the bidders Log In for more options

Bids are hidden by the project creator. Log in as the project creator or as one of the bidders to view bids. You will not be able to bid on this project if you are not qualified in one of the job categories. To see your qualifications click here.


    Bid on this Project