private void button1_Click(object sender, EventArgs e) { type = ChatObject.ChatTypeMess.File; OpenFileDialog openFileDialog1 = new OpenFileDialog { InitialDirectory = @"C:\", Title = "Browse Text Files", CheckFileExists = true, CheckPathExists = true, DefaultExt = "txt", Filter = "txt files (*.txt)|*.txt", FilterIndex = 2, RestoreDirectory = true, ReadOnlyChecked = true, ShowReadOnly = true }; if (openFileDialog1.ShowDialog() == DialogResult.OK) { txtMessage.Text = openFileDialog1.FileName; } }
private void txtMessage_KeyDown(object sender, KeyEventArgs e) { type = ChatObject.ChatTypeMess.Message; if (e.KeyCode == Keys.Enter) { button2_Click(sender, e); } }