Creating a phonebook (Visual C#) and loading saved information back to form -
i new c#
this form design: http://i.imgur.com/nb1vxwt.png
the main idea customers info can inuptted "title", "name" etc text boxes , saved listbox under clients name. when client selected list information displayed in text boxes.
this information (database) saved file on desktop , loaded form.
as mentioned, new c# , don't know start. have heard few names tossed around, serialization? linq xml? best way approach project , there similar projects can learn off.
a csv (comma separated values) file might idea.
you combine each customers details save each 1 new line in csv file.
for example.
string custdetails = title + ',' + fullname + ',' (and on.....) or (if comfortable using loops)
for (int = 0; < 5; i++) // 5 text boxes { custdetails += textbox[i].text + ','; // add each value + comma (to separate values later) } then write line file , save desktop.
then when form loaded, read file line line list, split string on commas (look c# string split)
and when selected index of list box changed, update values each text box.
hopefully clear enough , helps out :)
edit: added example of reading file line line
static void main(string[] args) { list<string> list = new list<string>(); using (streamreader sr = new streamreader(@"c:\users\tim\desktop\example.csv")) { string line; while ((line = sr.readline()) != null) { list.add(line); console.writeline(line); } } } this goes through file @ "c:\users\tim\desktop\example.csv" , puts every line of file list.
this useful because later, can find data in list customer want see in address book. need grab string, split @ every comma, , put data text boxes in form. :)
hopefully clarifies things you. (drop me message in comments if isn't clear enough or if don't understand :))
Comments
Post a Comment