You are not logged in.

juan

Beginner

  • "juan" started this thread

Posts: 20

Date of registration: Dec 11th 2008

  • Send private message

1

Tuesday, December 16th 2008, 11:31am

ItemData

Hello. I'm trying to import a VB project, and I have a problem in the following line of code:
i = Combo1.ItemData(Combo1.ListIndex) '<- Function or variable not defined!
(Jabaco highlights the "ItemData" word )

Greetings.

Peter

Trainee

  • "Peter" is male

Posts: 69

Date of registration: Nov 24th 2008

Location: Cologne, Germany

Occupation: Second Vice President of Distributed Junk and Trash Development

  • Send private message

2

Tuesday, December 16th 2008, 11:45am

RE: ItemData

Hello juan,

try ListData instead of ItemData.

Greetings ... Peter

juan

Beginner

  • "juan" started this thread

Posts: 20

Date of registration: Dec 11th 2008

  • Send private message

3

Tuesday, December 16th 2008, 1:53pm

Tank-you Peter:
For me, "ListData" return the same error than ItemData.
:)

This post has been edited 1 times, last edit by "juan" (Dec 16th 2008, 2:26pm)


Peter

Trainee

  • "Peter" is male

Posts: 69

Date of registration: Nov 24th 2008

Location: Cologne, Germany

Occupation: Second Vice President of Distributed Junk and Trash Development

  • Send private message

4

Tuesday, December 16th 2008, 2:35pm

For me, "ListData" return the same error than ItemData.


please try this snippet:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Public Sub List1_Click()
   
   MsgBox List1.ListData(List1.ListIndex)
   
End Sub

Public Sub Form_Load()

   Dim Counter As Integer
   
   For Counter = 0 To 100
      List1.AddItem "Item" + Cstr(Counter)
      List1.ListData(List1.ListCount-1) = "ItemData" + Cstr(Counter)
   Next

End Sub


Greetings ... Peter

juan

Beginner

  • "juan" started this thread

Posts: 20

Date of registration: Dec 11th 2008

  • Send private message

5

Tuesday, December 16th 2008, 4:11pm

List1.ListData(List1.ListCount-1) = "ItemData" + Cstr(Counter)
I understand!, ListData works with a ListBox, but don't work with ComboBox...
Is there anything similar to ListData for ComboBox?
Thank-you Peter. :)

This post has been edited 1 times, last edit by "juan" (Dec 16th 2008, 5:36pm)


Peter

Trainee

  • "Peter" is male

Posts: 69

Date of registration: Nov 24th 2008

Location: Cologne, Germany

Occupation: Second Vice President of Distributed Junk and Trash Development

  • Send private message

6

Tuesday, December 16th 2008, 9:24pm

ListData works with a ListBox, but don't work with ComboBox...

sorry, i didn't read your first posting correctly.

how about this solution?

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Type tComboboxItems
   Item As String
   Data As String
End Type

Dim ComboboxItems() As tComboboxItems

Public Sub Form_Load()
   
   Dim Counter As Integer
   
   ReDim ComboboxItems(100)
   
   For Counter = 0 To 100

      ComboboxItems(Counter).Item = "Item" + Cstr(Counter)
      ComboboxItems(Counter).Data = "Data" + Cstr(Counter)
   
      ComboBox1.AddItem ComboboxItems(Counter).Item
      
   Next

   
End Sub

Public Sub ComboBox1_Change()

   MsgBox(ComboboxItems(ComboBox1.ListIndex).Data)
   
End Sub


Greetings ... Peter

Manuel

Administrator

  • "Manuel" is male

Posts: 256

Date of registration: Jul 16th 2008

Location: Erlangen, Germany

Occupation: Software Developer

Hobbies: Jabaco, game theory, text-mining

  • Send private message

7

Tuesday, December 16th 2008, 9:46pm

hmm... is that a necessary method? with jabaco we could modify the framework for such methods - no more workarounds :)

Byo

Beginner

Posts: 4

Date of registration: Dec 7th 2008

  • Send private message

8

Tuesday, December 16th 2008, 11:39pm

In VB both ListBox and ComboBox controls have an ItemData property that is widely used to assign a numeric value (ID) to each item. I think that it would be a good thing if also Jabaco list and combo will work in this way ;)

Rate this thread
WoltLab Burning Board