VintageRice

[C#] - MultiClip (Expanded)

Feb 17th, 2017
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace clipKeep
  12. {
  13.     public partial class expandForm : Form
  14.     {
  15.         public expandForm(string listItem)
  16.         {
  17.             InitializeComponent();
  18.             //Read the text from the main form
  19.             fullTextBox.Text = listItem;
  20.         }
  21.  
  22.         //Default is false for obvious reasons
  23.         bool sendData = false;
  24.  
  25.         private void saveButton_Click(object sender, EventArgs e)
  26.         {
  27.             //If saved then send the data
  28.             sendData = true;
  29.             this.Close();
  30.         }
  31.  
  32.         public string textData()
  33.         {
  34.             //To send the data to the main form
  35.             if (sendData)
  36.                 return fullTextBox.Text;
  37.             else
  38.                 return "";
  39.         }
  40.  
  41.         private void fullTextBox_KeyPress(object sender, KeyPressEventArgs e)
  42.         {
  43.             //Allows pressing ENTER for saving
  44.             if (e.KeyChar == (char)Keys.Enter)
  45.                 saveButton_Click(null, null);
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment