can anyone figure what's wrong with my codes? (i'm too green... even i'm a upcoming 4th yr comsci student... T_T)
--------
-------
any help is appreciated to fix this little problem and simplified the program so it still follow the acronym K.I.S.S. (Keep It Simple, S2pid)...
--------
VB.NET:
Public Class Form8
Dim cnn As New OleDb.OleDbConnection("PROVIDER=microsoft.jet.oledb.4.0;Data Source=C:\Documents and Settings\Gene\My Documents\db4.mdb")
Dim sql As String
Dim n1, n2 As Double
Dim arr1() As Double
Dim dummy As String
Private Sub start()
ListBox1.Items.Clear()
input.Text = ""
tableup()
input.Focus()
D1.Visible = False
ListBox1.Visible = False
End Sub
Public Sub tableup()
Dim da As New OleDb.OleDbDataAdapter
Dim ds As New DataSet
cnn.Open()
sql = "SELECT * FROM Table2"
da = New OleDb.OleDbDataAdapter(sql, cnn)
da.Fill(ds, "t1")
cnn.Close()
L1.BeginUpdate()
L1.Items.Clear()
If ds.Tables("t1").Rows.Count > 0 Then
For Each dtr As DataRow In ds.Tables("t1").Rows
Dim objlv As ListViewItem = L1.Items.Add(dtr("Year"))
Dim arr(1) As String
arr(1) = dtr("NetCash")
D1.Text = arr(1)
dummy = D1.Text.ToString
ListBox1.Items.Add(dummy)
objlv.SubItems.AddRange(arr)
Next
L1.EndUpdate()
End If
End Sub
Private Sub Form8_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
start()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
start()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim arr2 As New System.Collections.ArrayList()
Dim ans, d12, d22 As Double
Dim Gu As Double = 0.015
arr2 = New ArrayList()
For n1 = 0 To ListBox1.Items.Count - 1
d12 = ListBox1.Items.Item(n1)
arr2.Add(d12)
Next
For n2 = 0 To ListBox1.Items.Count - 1
d22 = arr2(n2)
arr1(n2) = d22 ----> NullReferenceException error in runtime: Object reference not set to an instance of an object.
Next
ans = Math.Round(IRR(arr1, Gu), 2) * 100
input.Text = ans
End Sub
End Class
-------
any help is appreciated to fix this little problem and simplified the program so it still follow the acronym K.I.S.S. (Keep It Simple, S2pid)...