I have to code to where when I hit the button on my GUI screen, it displays information. Here's the problems I'm running into.
1. I have a one dimmensional array for a text-file that I'm reading in called "months.txt"
CHECK! Finished
2. I have a two dimmensional array that also has to be read in from a text-file called "rain.txt"
CHECK! Finished
3. I have to send the information from the array into a data grid through means of a query.
HELP!!
4. One text file needs to send information to both data grids by adding data together, and averaging data.
HELP!!!
5. I'm screwed.
I'll paste my sample code, but I'm not sure how much it will help. This is my entire code that I have. This program is due tomorrow, and I've been working on it all week. It's taken me this long to get to where I'm at. :/
VARIABLE NAMES: on my GUI screen (btnNebraska, dgvTotal, dgvAverage, frmRain) That's all the NAMED variables I have on the screen.
Sample Code:
Public Class frmRain
Dim months() As String = IO.File.ReadAllLines("months.txt")
Dim Rain(4, 11)
Dim numRows() As String = IO.File.ReadAllLines("rain.txt")
Dim Years() As Integer = {"1986", "1987", "1988", "1989", "1990"}
Private Sub frmRain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim months() As String = IO.File.ReadAllLines("months.txt")
Dim Rain(4, 11)
Dim Years() As Integer = {"1986", "1987", "1988", "1989", "1990"}
Dim numRows() As String = IO.File.ReadAllLines("rain.txt")
Dim line As String
Dim rainData() As String
For i As Integer = 0 To Rain.GetUpperBound(0)
line = numRows(i)
rainData = line.Split(","c)
For j As Integer = 0 To Rain.GetUpperBound(1)
Rain(i, j) = CDbl(rainData(j))
Next
Next
End Sub
Private Sub btnNebraska_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNebraska.Click
Dim line As String
Dim rainData() As String
For i As Integer = 0 To Rain.GetUpperBound(0)
line = numRows(i)
rainData = line.Split(","c)
For j As Integer = 0 To Rain.GetUpperBound(1)
Rain(i, j) = CDbl(rainData(j))
Next
Next
Dim monthsQuery = From months In months
Select months
dgvAverage.DataSource = monthsQuery.ToList
dgvAverage.CurrentCell = Nothing
dgvAverage.Columns("Length").HeaderText = "Month"
End Sub
End Class
1. I have a one dimmensional array for a text-file that I'm reading in called "months.txt"
CHECK! Finished
2. I have a two dimmensional array that also has to be read in from a text-file called "rain.txt"
CHECK! Finished
3. I have to send the information from the array into a data grid through means of a query.
HELP!!
4. One text file needs to send information to both data grids by adding data together, and averaging data.
HELP!!!
5. I'm screwed.
I'll paste my sample code, but I'm not sure how much it will help. This is my entire code that I have. This program is due tomorrow, and I've been working on it all week. It's taken me this long to get to where I'm at. :/
VARIABLE NAMES: on my GUI screen (btnNebraska, dgvTotal, dgvAverage, frmRain) That's all the NAMED variables I have on the screen.
Sample Code:
Public Class frmRain
Dim months() As String = IO.File.ReadAllLines("months.txt")
Dim Rain(4, 11)
Dim numRows() As String = IO.File.ReadAllLines("rain.txt")
Dim Years() As Integer = {"1986", "1987", "1988", "1989", "1990"}
Private Sub frmRain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim months() As String = IO.File.ReadAllLines("months.txt")
Dim Rain(4, 11)
Dim Years() As Integer = {"1986", "1987", "1988", "1989", "1990"}
Dim numRows() As String = IO.File.ReadAllLines("rain.txt")
Dim line As String
Dim rainData() As String
For i As Integer = 0 To Rain.GetUpperBound(0)
line = numRows(i)
rainData = line.Split(","c)
For j As Integer = 0 To Rain.GetUpperBound(1)
Rain(i, j) = CDbl(rainData(j))
Next
Next
End Sub
Private Sub btnNebraska_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNebraska.Click
Dim line As String
Dim rainData() As String
For i As Integer = 0 To Rain.GetUpperBound(0)
line = numRows(i)
rainData = line.Split(","c)
For j As Integer = 0 To Rain.GetUpperBound(1)
Rain(i, j) = CDbl(rainData(j))
Next
Next
Dim monthsQuery = From months In months
Select months
dgvAverage.DataSource = monthsQuery.ToList
dgvAverage.CurrentCell = Nothing
dgvAverage.Columns("Length").HeaderText = "Month"
End Sub
End Class