Skip to content

Instantly share code, notes, and snippets.

@aysegulsarikaya
Created April 7, 2019 14:31
Show Gist options
  • Select an option

  • Save aysegulsarikaya/9225d43fc8d7018a2d61a8b129508d08 to your computer and use it in GitHub Desktop.

Select an option

Save aysegulsarikaya/9225d43fc8d7018a2d61a8b129508d08 to your computer and use it in GitHub Desktop.
public List<string> list = new List<string>();
public int i = 0;
private void txtCopy_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.C)
{
if ((!string.IsNullOrEmpty(txtCopy.Text)) && (!list.Contains(txtCopy.Text)))
list.Add(txtCopy.Text);
}
}
private void txtPaste_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == (Keys.Control | Keys.V))
{
if (list.Count - 1 >= i)
{
Clipboard.Clear();
txtPaste.Clear();
txtPaste.Text = list[i].ToString();
i++;
}
if (list.Count == i)
{
i = 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment