Home > Net >  C # winform homemade a digital input keyboard, text how to transfer?
C # winform homemade a digital input keyboard, text how to transfer?

Time:10-04

Input window (i.e., homemade keyboard) by the button to edit the text into the textBox, edit the text of how to transfer to other Windows in the textBox?

CodePudding user response:

Isn't that window by value? Static variables, entrust can handle it

CodePudding user response:

If you are a child form based on the parent form popup (homemade keyboard), that is with the Owner to go,
Form1 is parent form, form2 is child form:
Click on the parent form text box,//child form
Private void textBox1_Click (object sender, EventArgs e)
{
Form2 frm2=new Form2 ();
Frm2. Owner=this;
Frm2. ShowDialog ();
}
//button click event in child form
Private void button1_Click (object sender, EventArgs e)
{
Form1 Form1=(Form1) enclosing the Owner;
Form1. TextBox1. Text="1231321";
}

Note: the textBox1 Modifiers in the parent form property must be set to Public,

CodePudding user response:

Is the value between the two Form, with trust

CodePudding user response:

I write a classmate before a Demo here you can also use the

CodePudding user response:

Entrust
TextChange inside call

CodePudding user response:

reference 1st floor glvicky response:
if you are a child form based on the parent form popup (homemade keyboard), that is with the Owner to go,
Form1 is parent form, form2 is child form:
Click on the parent form text box,//child form
Private void textBox1_Click (object sender, EventArgs e)
{
Form2 frm2=new Form2 ();
Frm2. Owner=this;
Frm2. ShowDialog ();
}
//button click event in child form
Private void button1_Click (object sender, EventArgs e)
{
Form1 Form1=(Form1) enclosing the Owner;
Form1. TextBox1. Text="1231321";
}

Note: the textBox1 Modifiers in the parent form property must be set to Public,
excuse me: I have more than one parent form, and there are many textBox, every textBox input to call child form to input (keyboard), so how to through the child form the "confirm" button, to transfer the input text into the target in the textBox?

CodePudding user response:

With commissioned custom keyboard, that is what the user control, define a transfer object
 public class InputEventArgs: EventArgs 
{
Public InputEventArgs (string inputText)
{
InputText=InputText;
}

Public string InputText
{
The get;
The set;
}
}


The keyboard controls defined inside the
 public delegate void ClickNumberKeyboardHandler (object sender, InputEventArgs e); 
The public event ClickNumberKeyboardHandler ClickNumberKeyboard;


Form called
 this. NumKeyboardCtrlNumAndLetter1. ClickNumberKeyboard +=NumKeyboardCtrlNumAndLetter1_ClickNumberKeyboard; 
Private void NumKeyboardCtrlNumAndLetter1_ClickNumberKeyboard (object sender, InputEventArgs e)
{
This. The textBox1. Text +=e.I nputText;
}





CodePudding user response:

The code on the http://www.loveying.com.cn/Keyboard_Demo.rar

CodePudding user response:

reference killed 7 floor matt, bull response:
use, custom keyboard, the user controls, define a transfer object
 public class InputEventArgs: EventArgs 
{
Public InputEventArgs (string inputText)
{
InputText=InputText;
}

Public string InputText
{
The get;
The set;
}
}


The keyboard controls defined inside the
 public delegate void ClickNumberKeyboardHandler (object sender, InputEventArgs e); 
The public event ClickNumberKeyboardHandler ClickNumberKeyboard;


Form called
 this. NumKeyboardCtrlNumAndLetter1. ClickNumberKeyboard +=NumKeyboardCtrlNumAndLetter1_ClickNumberKeyboard; 
Private void NumKeyboardCtrlNumAndLetter1_ClickNumberKeyboard (object sender, InputEventArgs e)
{
This. The textBox1. Text +=e.I nputText;
}

thank you, I have more than one parent Form, and there are many textBox, every textBox click enter to open the child Form Form6 (keyboard) to input, so how to through the child Form the "confirm" button, the input text (Form6. TextBox1) transfer to the target textBox (in other Form)?

CodePudding user response:

references 9 f ywf1992 response:
Quote: reference killed 7 floor matt, bull response:

With commissioned custom keyboard, that is what the user control, define a transfer object
 public class InputEventArgs: EventArgs 
{
Public InputEventArgs (string inputText)
{
InputText=InputText;
}

Public string InputText
{
The get;
The set;
}
}


The keyboard controls defined inside the
 public delegate void ClickNumberKeyboardHandler (object sender, InputEventArgs e); 
The public event ClickNumberKeyboardHandler ClickNumberKeyboard;


Form called
 this. NumKeyboardCtrlNumAndLetter1. ClickNumberKeyboard +=NumKeyboardCtrlNumAndLetter1_ClickNumberKeyboard; 
Private void NumKeyboardCtrlNumAndLetter1_ClickNumberKeyboard (object sender, InputEventArgs e)
{
This. The textBox1. Text +=e.I nputText;
}

thank you, I have more than one parent Form, and there are many textBox, every textBox click enter to open the child Form Form6 (keyboard) to input, so how to through the child Form the "confirm" button, the input text (Form6. TextBox1) transfer to the target textBox (in other Form)?

You are an on-screen keyboard function? The direct online to find a system or directly with own not to go? Do you want the change is so I can
Recommend you to use system's own
Private Process pr;
Pr=Process. The Start (" osk ");//open the on-screen keyboard
Pr. CloseMainWindow ();//off screen keyboard
Save trouble

CodePudding user response:

The practice of recommend you

nullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • C#
  • Related