The reason for just getting the last line of the file in the listbox is because you reading in another line even when you already found a valid name line. In other words, you don't have to reread the line in. You are just incrementing the file counter and causing a problem (which is causing it to go to the last line, making it in the listbox). Here is the corrected code:
This should logically do it. You find a valid string (with the if test) and it's valid, so enter it in the listbox. Understand? Any more questions?
dbFile = fopen("emplist.txt", "r");
while (fgets(names, sizeof(names), dbFile) != NULL)
if (names == '/')
names[strlen(names)-1] = '\0'; // get the '\n' char out of the string
SendMessage(dbList, LB_ADDSTRING, (LPARAM)100, (WPARAM)names);