Results 1 to 4 of 4

Thread: [RESOLVED] [2005][Newbie]StreamWriter.WriteLine() problem

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    2

    Resolved [RESOLVED] [2005][Newbie]StreamWriter.WriteLine() problem

    I am trying to make a application that will generate a Fibonacci Sequence.I am new to Visual Basic so I came to a stupid problem.Even I have used the WriteLine() again I can't make it work.I checked my other apps too , that used the same syntax but this doesn't work.
    So a little help would be appreciated.
    The problem is that even everything works just fine (the progress bar etc) the file generated will be blank.

    There are 2 textboxes (filebox and timesbox) , one progress bar (pb1) and one button (startbut)
    Code:
    Public Class Form1
    
        Private Sub startbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles startbut.Click
            Dim file As String = filebox.Text
            Dim StreamWriter As New System.IO.StreamWriter(file)
            Dim i As Integer = 3
            Dim times As Integer = timesbox.Text
            Dim a As Integer = 1
            Dim b As Integer = 1
            Dim c As Integer = 2
            StreamWriter.WriteLine(1)
            StreamWriter.WriteLine(1)
            StreamWriter.WriteLine(2)
    
            Do Until i = times
    
                a = c + b
                StreamWriter.WriteLine(a)
                i = i + 1
                pb1.Value = i / times * 100
                If i = times Then Exit Do
    
                b = a + c
                StreamWriter.WriteLine(b)
                i = i + 1
                pb1.Value = i / times * 100
                If i = times Then Exit Do
    
                c = a + b
                StreamWriter.WriteLine(c)
                i = i + 1
                pb1.Value = i / times * 100
                If i = times Then Exit Do
    
            Loop
    
        End Sub
    
    End Class
    thank you

    EDIT:I have already created a batch file so all the math etc are correct.
    EDIT2:Unfortunately I am leaving today for about 5 days so I won't be able to answer you.
    Last edited by ChrisSak; Apr 4th, 2007 at 05:16 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width