Results 1 to 3 of 3

Thread: Listviews

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651

    Talking

    Does anyone know whats wrong with this code: A error is brought back saying "Object Variable or With Block variable not set"


    Private Sub lvwJourneys_Click()

    TxtJourneyID.Text = Trim(lvwJourneys.SelectedItem.Text)Txtjourneyfrom.Text = Trim(lvwJourneys.SelectedItem.SubItems(1))
    Txtjourneyto.Text = Trim(lvwJourneys.SelectedItem.SubItems(2))
    Txtstandardmiles.Text = Trim(lvwJourneys.SelectedItem.SubItems(3))
    End Sub
    Gilly

  2. #2
    Addicted Member
    Join Date
    Apr 2000
    Location
    Sheffield, England.
    Posts
    136
    Code:
    Private Sub lvwJourneys_Click() 
    TxtJourneyID.Text = Trim(lvwJourneys.SelectedItem.Text)
    Txtjourneyfrom.Text = Trim(lvwJourneys.SelectedItem.SubItems(1)) 
    Txtjourneyto.Text = Trim(lvwJourneys.SelectedItem.SubItems(2)) 
    Txtstandardmiles.Text = Trim(lvwJourneys.SelectedItem.SubItems(3)) 
    End Sub
    ...should work... shouldn't it? If you were trying to run the exact code you posted, you had a carriage return in the wrong place.
    Visual Basic 6 Enterprise Edition + SP4

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    you get that error if you refer to an object reference without an object, so check out which of them isn't refering to anything at make sure either to make a new reference or you shouldn't handle the object at all, by avoiding it with errorhandling
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width