Click here to Skip to main content
15,900,973 members
Home / Discussions / C#
   

C#

 
QuestionProblem Replacing Smart Quotes Pin
Aaron Hartley6-Feb-09 13:33
Aaron Hartley6-Feb-09 13:33 
AnswerRe: Problem Replacing Smart Quotes Pin
Guffa6-Feb-09 14:51
Guffa6-Feb-09 14:51 
QuestionC# Registry Change Event Pin
Michael Fritzius6-Feb-09 12:07
professionalMichael Fritzius6-Feb-09 12:07 
AnswerRe: C# Registry Change Event Pin
Christian Graus6-Feb-09 12:42
protectorChristian Graus6-Feb-09 12:42 
AnswerRe: C# Registry Change Event Pin
cmk6-Feb-09 15:54
cmk6-Feb-09 15:54 
AnswerRe: C# Registry Change Event Pin
Giorgi Dalakishvili6-Feb-09 21:00
mentorGiorgi Dalakishvili6-Feb-09 21:00 
Questionhow to work with an opened text file in list box? Pin
pcsience6-Feb-09 9:57
pcsience6-Feb-09 9:57 
AnswerRe: how to work with an opened text file in list box? Pin
Luc Pattyn6-Feb-09 10:12
sitebuilderLuc Pattyn6-Feb-09 10:12 
Hi,

it is not completely clear what your problem is. Some facts for you:

1.
if you have a class Person holding all info regarding a person, then add instances of that class to the listbox (yes a listbox can hold items, not only strings; when they are not strings you must help it in displaying the items though, either by providing your own ToString method, or better yet by performing the painting yourself, i.e. DrawMode=OwnerDraw).

2.
if all info is in memory, it should be easy to find a specific person; Find could be a method inside the Person class, scanning all the existing Person objects (keep a static List of them in the class)
and return one Person, or a List< Person> when one or more matches are found.

3.
if all your persons info is in memory, there is no need to keep a file open at all. You could read the file once to populate the person objects and add them to the listbox, then keep the file closed; when you decide some changes in memory need to be saved to the file, just dump the current person info from memory to the file, overwriting everything that is there (for starters use a different filename, e.g. append current time as HHMMSS so you don't loose it all by mistake).

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles]

- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


modified on Friday, June 10, 2011 11:26 PM

GeneralRe: how to work with an opened text file in list box? Pin
pcsience7-Feb-09 8:25
pcsience7-Feb-09 8:25 
AnswerRe: how to work with an opened text file in list box? Pin
Luc Pattyn7-Feb-09 9:09
sitebuilderLuc Pattyn7-Feb-09 9:09 
QuestionRe: how to work with an opened text file in list box? Pin
pcsience8-Feb-09 8:53
pcsience8-Feb-09 8:53 
AnswerRe: how to work with an opened text file in list box? Pin
Luc Pattyn8-Feb-09 9:03
sitebuilderLuc Pattyn8-Feb-09 9:03 
GeneralRe: how to work with an opened text file in list box? Pin
pcsience8-Feb-09 9:42
pcsience8-Feb-09 9:42 
AnswerRe: how to work with an opened text file in list box? Pin
Luc Pattyn8-Feb-09 10:04
sitebuilderLuc Pattyn8-Feb-09 10:04 
QuestionRe: how to work with an opened text file in list box? Pin
pcsience9-Feb-09 9:08
pcsience9-Feb-09 9:08 
AnswerRe: how to work with an opened text file in list box? Pin
Luc Pattyn9-Feb-09 9:19
sitebuilderLuc Pattyn9-Feb-09 9:19 
QuestionCannot figure out how to get the row I need in a datatable Pin
compninja256-Feb-09 9:49
compninja256-Feb-09 9:49 
AnswerRe: Cannot figure out how to get the row I need in a datatable Pin
Luc Pattyn6-Feb-09 10:03
sitebuilderLuc Pattyn6-Feb-09 10:03 
GeneralRe: Cannot figure out how to get the row I need in a datatable Pin
compninja256-Feb-09 10:19
compninja256-Feb-09 10:19 
GeneralRe: Cannot figure out how to get the row I need in a datatable Pin
compninja259-Feb-09 3:04
compninja259-Feb-09 3:04 
AnswerRe: Cannot figure out how to get the row I need in a datatable Pin
Ennis Ray Lynch, Jr.6-Feb-09 10:48
Ennis Ray Lynch, Jr.6-Feb-09 10:48 
GeneralRe: Cannot figure out how to get the row I need in a datatable Pin
compninja259-Feb-09 2:13
compninja259-Feb-09 2:13 
GeneralRe: Cannot figure out how to get the row I need in a datatable Pin
Ennis Ray Lynch, Jr.9-Feb-09 2:42
Ennis Ray Lynch, Jr.9-Feb-09 2:42 
GeneralRe: Cannot figure out how to get the row I need in a datatable [modified] Pin
compninja259-Feb-09 2:52
compninja259-Feb-09 2:52 
QuestionIs using a User Control Embedded Class a good practice? Pin
MacSpudster6-Feb-09 9:05
professionalMacSpudster6-Feb-09 9:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.