1 Replies - 598 Views - Last Post: 13 January 2009 - 10:04 AM Rate Topic: -----

#1 CSI-Fan3  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-January 09

Showing list items in a textbox

Post icon  Posted 12 January 2009 - 11:27 AM

I'm kinda stuck on my school project, in which we have to make a database connection with Visual Basic.

Now I've made a list, that shows all the records in my table.
If I double click, I want the selected item in the list to be shown in textboxes.
I know I have to do this with a certain Index, but I can't get it right.

This is what I have now:

Private Sub Collst_DblClick()
Dim myVariable
myVariable = Collst.ListIndex
Data1.Recordset.Move myVariable
End Sub
 


The problem is, it seems as if it doens't get the index of the selected item, but just a random index.
I also get an error sometimes (not all the time, that's the weird thing) and it selects Data1.Recordset.Move myVariable

Can someone help me with this?

(edited because I forgot a bit)

This post has been edited by CSI-Fan3: 12 January 2009 - 11:34 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Showing list items in a textbox

#2 CSI-Fan3  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-January 09

Re: Showing list items in a textbox

Posted 13 January 2009 - 10:04 AM

I just checked it again, and I found something very strange:

The first time I click on an item in the listbox, it shows the right data in the textboxes, the second time I click on an item in the listbox it shows different data then the one I clicked, and the third time I click on an item in the listbox, I get the following error:
"Run time error 3426:
This action was cancelled by an associated object"

Does someone know how this happens?

And I forgot to say that the textboxes are linked to certain columns in the table I get the data out of.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1