I've created a custom popup input box (much like the one from VB). It saves the string that has been inputed. Most of the code has been imported from here >>
http://www.csharp-examples.net/inputbox/
I want to add a Enter key functionality, in-order to speed up the process since the user will be using this box a lot.
Since the custom Input box is created on the fly - I can't simply right click its object and add the event. It needs to be done in code. But I am not able to get it correct.Code:private void EnterKey(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { InputResponse = this.txtInput.Text; this.Close(); } }
I've tried this.txtInput.TextChanged -- but the error isCode:// // txtInput // this.txtInput.Location = new System.Drawing.Point(10, 36); this.txtInput.Name = "txtInput"; this.txtInput.Size = new System.Drawing.Size(200, 20); this.txtInput.TabIndex = 0; this.txtInput.Text = ""; this.txtInput.??? += new System.EventHandler(this.EnterKey); //
No overload for 'EnterKey' matches delegate 'System.EventHandler'
dunno what to do here.




Reply With Quote