The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.
I've only used VB a few times before and am totally in the dark as how to do what I'm being asked to do for this part of the assignment
Much googling hasn't helped
I have a text file with a series of numbers, each series seperated by zeros
eg:
1
2
3
0
1
2
3
I need my application to read the text file and store each number in an array. There's a bunch of other stuff too, but I got how to do all of that, I don't know how to get it to look in a file and pull numbers out, or put them in arrays, or to differentiate between series
Really wish I hadn't sold my textbooks but, the book store only needed 2 more and offered a good price
Since you don't know how large the array will be until you stuff it, I think "Dynamic Arrays" may be particularly useful.
Hope these resources help!
Thanks I'm gonna read these over
I mean it seems like it's way too complicated and I'm over thinking it, given that the next hardest assignment I've done consists entirely of this
Private Sub Calculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCalculate.Click
' First it sets the variable we're going to use, then clears the listbox from previous usage
A = Val(TxtInputbox.Text)
LstListbox.Items.Clear()
' Checks if the value of the textbox is less than 100 before doing anything, if it is then we display
' an error message
If Val(TxtInputbox.Text) < 100 Then
LblWarningLabel.Show()
LstListbox.Items.Add(B)
' Checks if the value is over or equal to 100 and if it is hide previous warnings...
ElseIf Val(TxtInputbox.Text) >= 100 Then
LblWarningLabel.Hide()
' ... and start the loop, adding items to the listbox until the variable is ten less than the textbox
Do
LstListbox.Items.Add(A - 1)
A = A - 1
Loop Until (A = Val(TxtInputbox.Text) - 10)
End If
End Sub
And took like, 15 minutes
It's VB.net btw
Edit: i think that first link is only applicable for vb6
Imports System
Imports System.IO
Class Test
Public Shared Sub Main()
Try
' Create an instance of StreamReader to read from a file.
Dim sr As StreamReader = New StreamReader("TestFile.txt")
Dim line As String
' Read and display the lines from the file until the end
' of the file is reached.
Do
line = sr.ReadLine()
Console.WriteLine(Line)
Loop Until line Is Nothing
sr.Close()
Catch E As Exception
' Let the user know what went wrong.
Console.WriteLine("The file could not be read:")
Console.WriteLine(E.Message)
End Try
End Sub
End Class
bowen on
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
Posts
http://support.microsoft.com/kb/186118
To stuff things in arrays, here's a link:
http://patorjk.com/programming/tutorials/vbarrays.htm
Since you don't know how large the array will be until you stuff it, I think "Dynamic Arrays" may be particularly useful.
Hope these resources help!
Also, VB6 or VB.NET?
Thanks I'm gonna read these over
I mean it seems like it's way too complicated and I'm over thinking it, given that the next hardest assignment I've done consists entirely of this
It's VB.net btw
Edit: i think that first link is only applicable for vb6
http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx
we've only been on VB for 2 weeks and I have zero prior experience
yea streamreader is what hes doing, should be able to get it between the example and your link bowen thanks