![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
Limit combo box choice according to database created in folderi creating database by month, so every month i got a database to store the data.. in my application i would like to have a combo box to select which database i would like to display according to month and year...
how can i code my combo box to only display database that have created in my folder? example: in my folder i have Jan05, Feb05 and Mar05 database so my combo box only have the choice of Jan05, Feb05 and Mar05 for me to selected. |
|
#2
|
||||
|
||||
|
i guess you are using MFC, so you should use CFileFind class to get the file names in your folder and display it in the combo box. since I currently don't hav a VC++6.0, so can't post the exact program that works, but here is a guide...
CFileFind has the member function to find filed in a folder based on the file name pattern passed to the function, for example: FindFile(_T("*.txt"))) will find file with '.txt' extensions, so in your case, FindFile(_T("*.mdb"))) will find files with the mdb extensions for the data base, or if you your data base is of other type, then use accordingly.. here is a code saple which gts all the files in a directory: CPP / C++ / C Code:
the above sample code gets all the file, so do a litle editing so that it gets only the database file, i use '.mdb' here for my database: CPP / C++ / C Code:
BTW: if you want to post MFC related question, plase post in the MFC or Visual C++ Forum. __________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds |
|
#3
|
|||
|
|||
|
Quote:
if MyFileName = abc_Jan05.mdb but i just want Jan05 show in my combo box how can i limit it? |
|
#4
|
||||
|
||||
|
Quote:
that you need to chop the string your self... is all your files would hav the same filename format, like the above 'abc_Jan05.mdb'?? the a litle CString oprations could do what you want: CPP / C++ / C Code:
strAfter would have 'Jan05'.. hope that helps... __________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds |
Recent GIDBlog
Last Week of IA Training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Yet another CD burner problem: Lite-On LSC-24082K | Erwin | Computer Hardware Forum | 1 | 22-May-2004 11:28 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The