I am making a small bill manager program. I have setup a listview and I am using access db. Things are working great and when I pay a bill it enters in the database perfect, but when it is shown in the listview it shows the date plus the time. Why does it show correct in the database and not in the listview? I tried using .ToShortDateString instead .ToString but then it just tells me it doesn't like late binding.
the bold line is where I tried .ToShortDateString and it errors saying late binding. I just want to know why the late binding and also why the hell it is showing the time after the date when it is not like that in the database.Code:Public Sub LoadDataGrid() Dim i As Integer Dim strImageKey As Integer 'Dim CurrentMonth As String = CStr(Date.Now) Try 'connection.Open() If connection.State = ConnectionState.Closed Then connection.Open() End If Me.table.Clear() Me.adapter.Fill(Me.table) ' Create a DataView with the table. Dim view As New DataView(Me.table) Dim x As Decimal Dim y As Decimal LblBillCount.Text = CStr(view.Count) For i = 0 To view.Count - 1 Me.LvBills.BeginUpdate() If CBool(view(i)("isPaid")) = True Then strImageKey = 0 Else strImageKey = 1 End If LvBills.Items.Add(view(i)("BillName").ToString, view(i)("BillName").ToString, strImageKey) LvBills.Items(i).SubItems.Add(view(i)("PaymentDate").ToString) LvBills.Items(i).SubItems.Add("$" & view(i)("Amount").ToString) LvBills.Items(i).SubItems.Add("$" & view(i)("Balance").ToString) ' add id to tag so we can call it later LvBills.Items(i).Tag = CStr(view(i)("BillName")) Me.LvBills.EndUpdate() x = x + CDec(view(i)("Amount")) y = y + CDec(view(i)("Balance")) Next i LblPayTotal.Text = "$" & String.Format("{0:C2}", CStr(CDec(x))) LblBalanceTotal.Text = "$" & String.Format("{0:C2}", CStr(CDec(y))) Catch ex As Exception Debug.WriteLine(ex.Message) End Try End Sub




Reply With Quote