INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Listview

Listview

(OP)
Have a list view that populates members from an Access DB. Purpose is then to populate a form when a members name is clicked:

CODE -->

Private Sub mnuView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuView.Click
        Dim frm As New frmAllView
        tsStatus.Text = ""
        FormChange(bFormChanged)
        Me.Hide()
        If Not dataMgr.MTDatabase Then
            MessageBox.Show("Enter a record to continue", "No records")
            Me.Show()
        Else
            frm.ShowDialog() ' this throws an exception
                 
If frm.lvwDisplay.SelectedIndices.Count = 0 Then Exit Sub Else iID = CInt(frm.lvwDisplay.SelectedItems(0).Index) NoRecords() dataMgr.FindOneName(iID, nc) FillBoxes() End If Select Case frm.Action Case Is = CStr(iID) If frmAllView.lvwDisplay.Items.Count = 0 Then Exit Sub Else iID = CInt(frmAllView.lvwDisplay.SelectedItems(0).Text) dataMgr.FindOneName(iID, nc) FillBoxes() txtLastName.Focus() End If Case Is = "X" MsgBox("X") End Select End If txtFirstName.Focus() bFormChanged = False FormChange(bFormChanged) End Sub

Any ideas would be helpful. Thank you.

RE: Listview


Is there code in the New() method of frmAllView, or in the Form_Load event handler?

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!

RE: Listview

(OP)
This from _load:

CODE -->

Private Sub frmAllView_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim nc As New cCustomers
        Dim dataMgr As New cData
        Dim sKey As String = ""
        Dim sName As String = ""
        Dim sCityStZip As String = ""
        Dim sPhone As String = ""
        Dim sDatePd As String = ""
        lv = dataMgr.DisplayAll(lv)
        With lvwDisplay
            .Show()
            .Items.Clear()
            .Columns.Add("ID", 0)
            .Columns.Add("Acct#", 50)
            .Columns.Add("Name", 200)
            .Columns.Add("Address", 210)
            .Columns.Add("City, State Zip", 140)
            .Columns.Add("Telephone", 150)
            .Columns.Add("Date Pd", 80, HorizontalAlignment.Center)
            .Columns.Add("Amt Pd", 70, HorizontalAlignment.Right)
            .Refresh()
            .View = View.Details
            .Width = 925
            .Height = 950
        End With
        With Me
            .Text = "Click Record to edit"
            .Top = 25
            .Width = 950
            Height = 1000
            .StartPosition = FormStartPosition.CenterScreen
        End With

        Dim sItem As ListViewItem
        For Each nc In lv
            Dim areaCode As String = ""
            Dim Exchange As String = ""
            Dim sNumber As String = ""
            Dim Phone As String = nc.Phone
            Dim result As String = ""
            If nc.Phone.ToString = "" Then
                sPhone = nc.Phone
            Else
                result = Phone.Substring(1, 3)
                areaCode = Phone.Substring(1, 3)
                areaCode = nc.Phone.Substring(1, 3)
                Exchange = nc.Phone.Substring(5, 3)
                sPhone = areaCode & ")" & Exchange & "-" & sNumber
            End If
            '' ''sKey = Format(nc.CustomerID, "0000")
            sName = Trim(nc.Lastname) & ", " & Trim(nc.Firstname)
            Dim iAmtPd As String = FormatCurrency(nc.AmountPaid, 2)
            Dim sAddress = Trim(nc.StreetNumber) & " " & Trim(nc.Address)
            sCityStZip = Trim(nc.City) & ", " & Trim(nc.State) & " " & Trim(nc.Zip)
            sDatePd = (nc.DatePd)
            sItem = New ListViewItem
            sItem.Text = CStr(sKey)
            sItem.SubItems.Add(nc.AccountNumber)
            sItem.SubItems.Add(sName)
            sItem.SubItems.Add(sAddress)
            sItem.SubItems.Add(sCityStZip)
            sItem.SubItems.Add(Phone)
            sItem.SubItems.Add(sDatePd)
            sItem.SubItems.Add(FormatCurrency(iAmtPd, 2))
            lvwDisplay.Items.Add(sItem)
        Next nc
    End Sub 

Is this what you are looking for?

RE: Listview

Well, nothing there looks like it could be causing the problem. Click the View Detail link on the error message and post that here. Basically we're looking for the place where you try to use a System.EventArgs object in place of a System.Windows.Forms.KeyPressEventArgs object.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close