These are the brief steps to write a program for text chat...
1. Decide whether you want a application to chat over internet or a local network. This helps you to pick a protocol for data transfer and development tools / technologies to develop it
2. Google search to study how chatting applications work.
3. There are multiple ways to transfer files on the network. Select the one which suits the requirement
4. Create a flowchart of how the application works from start to end.
5. Design the database structure if you have decided to use. It will be mostly required for storing user info and chat logs
6. Use Visual Studio or any other similar IDE to code your project.
The end product will be a text chat application with file transfer feature and with full source code.
Some reference links for you
TCP/IP Chat Application Using C#[
^]
http://www.dreamincode.net/forums/topic/33396-basic-clientserver-chat-application-in-c%23/[
^]
http://www.junnark.com/junnark/Blog/Detail/2[
^]