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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Arrays

Status
Not open for further replies.

AdamWhitehouse

Programmer
Aug 7, 2000
34
GB
I have got a dynamic array which reads Tags and strings in from a .ini file, How can I read the "Array" Id back only knowing the string, ie:

dim tag$(3)
tag$(1)="ONE"
tag$(2)="TWO"
tag$(3)="THREE"

"THREE"= ???? I want to read back 3 here.

At the moment I am finding the id by using a for loop ie;
for a= 1 to 3
if tag$(a)="ONE" then etc....

this is costly in time when the tag list is huge.
any suggestions appreciated.
Adam



 
Adam - I'm surprised that in the two and a half years that you've been posting to Tek-Tips that you haven't found any posts helpful, and have been so reticent to try and help others in some of their questions. The beauty of Tek-Tips is that it is a forum where professional can share ideas. This is not a tech support site, and the professionals who contribute do so on their own time. It is a give and take relationship, and works best when everyone does both, give and take.

That being said, I suggest that you take a look at the GetPrivateProfileString API. Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Cajun Centurion - I do read other posts, and when I have enough knowledge to be able to help others, I do and will.
I submit to forums on other sites, about different programming languages, and help people who have less knowledge than myself, what goes around ...

I am already using GetPrivateProfileString to read the ini file, this assigns the strings in the ini file into my array, of which I need to find the position in the array.
 
I glad that you will offer help, and acknowledge help, as that is what Tek-Tips is about. And as you do, your profile will reflect that and that's great.

Perhaps instead of using an array, you might try using a keyed collection, or a dictionary object for your storage, which should provide faster access. Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top