Hey all, I am currently making a phonebook as a final project for my introductory c# class and I was wondering how can I save my form's contents to a database? and how do I export it to an excel file?

I have a listview of items that indicate name, last name, affiliation, contact numbers, etc. that I would like to be saved unto something so that the user can have the choice to load their phonebook list when they log on in their account. I would also like to have the option for them to export their phonebook list to excel for printing and more organization and such. And is it possible to encrypt the file that contains the database so that the user cannot access it in anyway without using my program? or is that too hard? I would be submitting this project on tuesday, for he only gave it to us this tuesday (yeah, 1 week, such a pain).

The professor has taught us nothing about these 3 things but I would like to apply it to my project to impress him, and get a higher grade of course.

Thank you so much for those who'd be suggesting and pointing me to the proper direction!

8 Years
Discussion Span
Last Post by ticktock

>I was wondering how can I save my form's contents to a database?

Read/Learn/Implement - ADO.NET

>how do I export it to an excel file?

There are number of ways but I'd suggest Microsoft Report.



Thank you for the links, I am reading about ADO.NET now. Is it just simplier if I would write my data on a text file and then export it to my form whenever the user wants?


>Is it just simplier if I would write my data on a text file and then export it to my form whenever the user wants?

Yes. CSV files can be read/update by the ADO.NET, excel as well as file system classes.



I think, I'll go with writing it in a plain text document, and by this I don't intend to use ADO.NET.

I am just reading about it now and am having a tough time understanding what I should do and all, the project is due on tuesday and with the rate I'm going at I won't finish in time. But a problem with this plan of mine is when I export the text from the plain text document, I don't know how to format it in my listview. And the only idea I have of file streaming is that from my C++ class in which I think is very differently applied in C#.


hey all, is there anyway i can disable the 'x' button on a message box?

also for example i set a button in a dialog box as an ok button and then after the user presses the button some processes like determining if any of the textboxes were empty or if all the textboxes are empty are performed and if found out that all the textboxes were not filled up an error message pops up and then if the user clicks ok the dialogbox will not close. I am currently trying this and whenever the user clicks the ok button on my dialog box it closes the whole dialog box regardless of the fact if the user did not enter any input or some input


sorry for this double post

Edited by ticktock: n/a


okay I tried this, but it does not seem that good, please help:

if (!(contactDetailInfo.Visible))

it seems bruteforced to me, i was thinking more of like after the user presses the ok button on the messagebox the dialogbox won't pop again but still remain opened

okay just as i expected my solution was wrong, even if indeed at the first time this event is handled correctly, for the second time it does not.

Edited by ticktock: n/a


okay just did it i used:

this.DialogResult = DialogResult.None;

it works flawlessly, now how do I disable the 'x' close button from my dialogbox?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.