Hi
Reading from a DB table into a ListView, I can store the key of a record in Col 0 and make this column zero width. THis makes subsequent record manipulation simple
Reading the functions in FF3 it appears I can do much the same thing with a combobox using set/get ItemData. I have had no luck and show simple code from a test project below.
Maybe I am misunderstanding the use of GetItemData and also, I'm not fully comfortable with my understanding of "The 32-bit value to be associated the the string"!
Any help much appreciated.
Ian B
~~~~~~~~~~~
'--------------------------------------------------------------------------------
Function FORM1_WM_CREATE ( _
hWndForm As Dword, _ ' handle of Form
ByVal UserData As Long _ ' optional user defined Long value
) As Long
Dim lRow As Long
Dim nValue As Long
lRow = FF_ComboBox_AddString( HWND_FORM1_COMBO1, "Line 1" )
FF_ComboBox_SetItemData( HWND_FORM1_COMBO1, lRow, 0 )
End Function
'--------------------------------------------------------------------------------
Function FORM1_COMMAND1_BN_CLICKED ( _
ControlIndex As Long, _ ' index in Control Array
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
idButtonControl As Long _ ' identifier of button
) As Long
Dim sIndex As String
sIndex = FF_ComboBox_GetItemData( HWND_FORM1_COMBO1, 0 ) <<< Compiler errors with message "String operand expected"
MsgBox sIndex
End Function
~~~~~~~~~
Hi Ian,
the problem is here:
QuotesIndex = FF_ComboBox_GetItemData( HWND_FORM1_COMBO1, 0 )
You are trying to assign a long value to a string var. You need to convert to a string first:
sIndex = Format$(FF_ComboBox_GetItemData( HWND_FORM1_COMBO1, 0 ))
I attached a litte demo.
Regards
Rolf
Thanks for your help Rolf.
When I saw your reply the "penny dropped" immediately.
Why didn't I pay attention when the compiler was trying to tell me the solution?
Must be old age catching up!
Again thanks
Ian B