hi.. i tried to make a array list of 5 element in which recent 5 clipboard text is copied
but i am not able to do this every time clipboard text overwrites the previous one and in first array element
and prints only the last one i want to print all how can i do this.
if my case is possible thn please give me some solution
Loading
Sam HobbsPosted Nov 9, 2010, 5:03 AM
Suthish NairPosted Nov 9, 2010, 12:25 AM
try saving to a text file, later retrive...
shruti sinhaPosted Nov 9, 2010, 12:01 AM
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
const int MaxItems = 5;
static readonly List
[DllImport("user32.dll")]
static extern IntPtr GetOpenClipboardWindow();
public static void SaveClipboard()
{
ClipboardData.Add(Clipboard.GetText());
if (ClipboardData.Count > MaxItems) ClipboardData.RemoveAt(0);
}
private void button1_Click(object sender, EventArgs e)
{
string str;
for (int i = 0; i < 3; i++)
{
//Clipboard.SetText(i.ToString());
str = Clipboard.GetText();
SaveClipboard();
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
foreach (var s in ClipboardData)
{
MessageBox.Show(s);
}
}
}
}
Sam HobbsPosted Oct 24, 2010, 10:41 PM
I am sorry, but the question is not clear. I don't understand what you mean by "recent 5 clipboard text" and I am not sure what you mean by array. I have no idea what you mean by "clipboard text overwrites the previous one".
shruti sinhaPosted Oct 24, 2010, 8:30 AM
Suthish NairPosted Oct 24, 2010, 4:10 AM