Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combobox
Message
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00905099
Message ID:
00905145
Views:
30
If you read the help file about the NewIndex property, you will discover that this property returns the index of the last item you have added to combo. What you need is the ItemData property. See the help for an example of how to use it.


>Hi All:
>I have a combo box on my form, and its style is 2-drowdown List. How can I set its newindex or index value to the record ID from my record set. This is what I am trying to do:
>
>oRecData.Open "SELECT Location_Name,Location_ID FROM Locations", oDataConn
>If oRecData.RecordCount > 0 Then
>For i = 1 To oRecData.RecordCount
>With cmboevebldg
>.NewIndex = oRecData.Fields("Location_ID")
>.AddItem oRecData.Fields("Location_Name")
>End With
>'combostate.AddItem RTrim(oRecState.Fields("state_Code"))
>oRecData.MoveNext
>Next i
>End If
>
>I get an error when I try to set the newindex. The error is "can not assign to read-only property" What do I need to do in order to assign a value to the index?
>
>Thanks
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform