Hi there
Another noob question from me...one of these days I'll get the hang of this VB!
I am importing data from an Access table that has four columns/fields. I have set up the relevant headings etc on the list view control...but I have also set up a 5th column as I want to have that representing the percentage change between columns 3 and 4 (which are numeric).
Here's my code. What I want to know, is that having confused myself with code I've written / adapted from advice given etc where do I put in a forumula to add something to a column in my list view that is a calculation based on two columns imported from the table?
Private Sub citydata_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dataCity As New DataTable()
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=E:\globexdata\globex.mdb"
Dim sqlString As String = "SELECT * FROM cities"
Dim dataAdapt As New OleDb.OleDbDataAdapter(sqlString, connectionString)
dataAdapt.Fill(dataCity)
dataAdapt.Dispose()
Dim qtyCols As Integer = dataCity.Columns.Count
Dim qtyRows As Integer = dataCity.Rows.Count
Dim itm As ListViewItem
Dim Row As DataRow
Dim str(qtyCols - 1) As String
Dim i As Integer = 0
Dim y As Integer
While i <= qtyRows - 1
y = 0
Row = dataCity.Rows(i)
While y <= qtyCols - 1
If Len(Row(y).ToString) > 0 Then
str(y) = Row(y)
Else
str(y) = ""
End If
y = y + 1
End While
itm = New ListViewItem(str)
lstViewpop.Items.Add(itm)
i = i + 1
End While
End Sub