Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combobox .additem property?

Status
Not open for further replies.

dtrinowitz

Programmer
Jan 29, 2005
12
DE
Hi, im creating a chat message program. it sends a meassage to others by using the ip address.
THis works fine, however the problem im having is:
i added a dropdowm combobox and a textbox and a command button.
this is to add users to the combobox. you enter the name into the textbox and there ip in 4 other textboxes click the commandbutton and it is supposed to add that information to the combobox. To do soo im using the following command:
combo1.additem text1.text+text2.text
text1 is the name of the user.
the other 4 textboxes display the ip address.
the additem property works but it is supposed to just show the name in the combobox and remember the ip without showing it in the combobox too. even though that is the snmalles problem. i need this to work at runtime.
it works at runtime but when i reenter the program it lost all the data. now what i need is a code which makes the program remember what i added last time a ran it. All i know is that the data needs to be stored somewhere outside the programm but i dont know a code to make it do that.
It would be great if any1 could post a code to stor and retrive the data at runtime.

And if possible tell me how to make the combobox remember the ip without showing it under the additem property neyxt to the name in the combobox.

i hope the description of my problem is understandable.
thx in advance
 
Have you tried the .ItemData property. It stores a long value that can correcspond to a specific element in the list property (both are arrays). You may need to reformat the IP so it is allowed in the .itemdata property.

Another option would be to store the values in a UDT array and fill the combo with the name element (of the UDT array). Then you can use the .listindex property to retrieve that other information from the UDT array.

zemp
 
To store the data between runs you need to either write it out to a file or store it in the registry.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
dtrinowitz

Did you figure this out or do you need any more help?

[gray]Experience is something you don't get until just after you need it.[/gray]
 
Nope, still didnt figure it out. Would appreciate if any1 would post a code here which i can use to solve the problem.
 
To make a program 'remember' certain settings look into using the GetSetting and SaveSetting functions. They are built in functions that store values in the local registry.

zemp
 
Use ListView instead.

You can add a "key" value of a string, ie your IP address
then you can add a text value, ie, the name.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top