Okay I am thinking I need some more help. So far this is my code and I nothing is coming up with the file.
{Imports System.IO
Public Class Form1
Private Sub BtnProcessData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnProcessData.Click
Dim previous1 As Long
Dim previous2 As Long
Dim i As Integer
Dim input As Integer
Dim fibonacci As Long
previous1 = 1
previous2 = 1
input = CInt(txtinput.Text)
If input = 1 Then
fibonacci = 1
ElseIf input = 2 Then
fibonacci = 1
Else
For i = 3 To input
fibonacci = previous1 + previous2
previous1 = previous2
previous2 = fibonacci
Next i
End If
TxtFibonacci.Text = CStr(fibonacci)
End Sub
End Class
Public Class Form1
Dim InpFileName As String, FileOpenFlag As Integer
Dim FileData(100) As String, ItemCount As Integer
Dim DataFile As StreamReader
Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
' Get name of file to read and open file
Dim dgrResult As DialogResult
Dim dlgOpen As New OpenFileDialog
If FileOpenFlag > 0 Then DataFile.Close()
' Set properties and open file dialog
dlgOpen.InitialDirectory = "F:"
dlgOpen.Filter = "Text Files|*.txt|Word Files|*.doc|All Files|*.*"
dgrResult = dlgOpen.ShowDialog()
' If file name OK then open file for reading
If dgrResult = DialogResult.OK Then
InpFileName = dlgOpen.FileName ' Get filename
DataFile = File.OpenText(InpFileName)
FileOpenFlag = 1
ItemCount = 0
Else
txtData.Text = "File not specified"
End If
End Sub
Private Sub btnReadNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReadNext.Click
' Read one line from the file
Dim Temp As String
If FileOpenFlag > 0 Then
If DataFile.Peek <> -1 Then
Temp = DataFile.ReadLine
If Temp.Trim <> "" Then
ItemCount = ItemCount + 1
FileData(ItemCount) = Temp.Trim
txtItemNumber.Text = CStr(ItemCount)
txtData.Text = FileData(ItemCount)
Else
txtItemNumber.Text = ""
txtData.Text = "Blank line - Not stored"
End If
End If
End If
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If FileOpenFlag > 0 Then DataFile.Close()
End Sub
Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
' Not complete; should check that text box contains
' a valid number
Dim Index As Integer
Index = CInt(txtItemNumber.Text)
txtData.Text = FileData(Index)
End Sub
End Class
}
I don't know really what I did wrong?
Can you please please help ?? Thanks!