Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello
I saw Sticky notes with C# (Simple application)[^], but it is not C# 2010 and I cannot understand how it save and load a colored and bold notes in sticky note.
Posted
Comments
Richard MacCutchan 24-Sep-15 4:26am    
You should post your question in the forum at the end of the article.

1 solution

check it out a simple way of creating sticky application
Sticky Notes type application using C#



Technology: C#.NET

Major components of .NET used in this app:
Windows Form
Text Box control
Serialization concept

What is "sticky notes"?
Ans: Sticky note is a simple note keeping application of Windows. It remains on the top of the every window. We can use it to write down small notes that requires frequent attention.

Concept of serialization:
To save the current state of sticky note we can use Serialization concept. Serialization is the process of converting an object into a stream of bytes in order to store the object or transmit it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed. The reverse process is called deserialization.

Steps to create this utility:
Create a Windows Form based project in IDE.
Add TextBox control on the Windows form
Set following properties of the TextBox control:
Dock Style to Fill
Multiline to True
Code Snippnets:
//storing notes in My Documents of windows

FileStream mynotes = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\mynotes.nfc", FileMode.Create);

BinaryFormatter format = new BinaryFormatter();
format.Serialize(mynotes, txtUser.Text);
mynotes.Close();



//opening notes on application launch
if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\mynotes.nfc"))
{
FileStream opennotes = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\mynotes.nfc", FileMode.Open);
BinaryFormatter format = new BinaryFormatter();
txtUser.Text = (string)format.Deserialize(opennotes);
opennotes.Close();
}
 
Share this answer
 
Comments
Richard MacCutchan 24-Sep-15 4:28am    
You should follow the link in OP's question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900