Home > Net >  Windows forms control in the library user controls between the values
Windows forms control in the library user controls between the values

Time:05-20

I did two custom controls: Input_Content. Cs and Output_Content. Cs
In the generated. DLL, after application of the DLL in the form, but under the Input_Content this control input in the form after enter a number, and cannot be Output_Content this control, according to the text box
Is to have spread from Input_Content to Output_Content values can be determined,
I can't get no, master can help to reassure it for me?
-- Input_Content. Cs -- -- -- -- --
using System;
using System.Collections.Generic;
Using System.Com ponentModel;
using System.Drawing;
Using System. The Data;
Using System. Linq;
Using System. The Text;
Using System. Windows. Forms;


The namespace Self_ControlLibrary
{
Public partial class Input_Content: UserControl
{
Public static string shuxingbianliang;//the value attribute
Public int keypress_flag=0;//button logo
//public static string jingtaichuanzhipar="";


Public Input_Content ()
{
InitializeComponent();
}

Public void Input_Content_txb_keypress (object sender, KeyPressEventArgs e)
{
If (e.K eyChar=='\ r')
{
Shuxingbianliang=Input_Content_txb. Text. The ToString ();
Keypress_flag=1;
//jingtaichuanzhipar=Input_Content_txb. Text. The ToString ();
Output_Content optc=new Output_Content ();
}

}
//[DesignerSerializationVisibility (DesignerSerializationVisibility. Content)]
Public static string SHUXINGBIANLIANG
{
The get
{
Return shuxingbianliang;
}
Set
{
Shuxingbianliang=value;
}
}
}
}
-- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- - Output_Content. Cs -- -- -- -- -- -- --
using System;
using System.Collections.Generic;
Using System.Com ponentModel;
using System.Drawing;
Using System. The Data;
Using System. Linq;
Using System. The Text;
Using System. Windows. Forms;

The namespace Self_ControlLibrary
{
Public partial class Output_Content: UserControl
{
Public Output_Content ()
{
InitializeComponent();

//MessageBox. Show (Input_Content. Jingtaichuanzhipar);
//Output_Content_txb. Text=string. The Empty;
Output_Content_txb. Text=Input_Content. SHUXINGBIANLIANG;
MessageBox. Show (Output_Content_txb. Text);
}
}
}
-- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- call the control FORM FORM -- -- -- -- -- -- -- -- --
using System;
using System.Collections.Generic;
Using System.Com ponentModel;
Using System. The Data;
using System.Drawing;
Using System. Linq;
Using System. The Text;
Using System. Windows. Forms;
Using Self_ControlLibrary;

The namespace Test_Selfcontrol1
{
Public partial class Form1: Form
{
Public _click ()
{
InitializeComponent();
KeyPreview=true;
}

Private void input_Content1_keypress (object sender, KeyPressEventArgs e)
{
Output_Content1. Output_Content_txb. Text=Input_Content. SHUXINGBIANLIANG;
}
}
}

CodePudding user response:

You this control is amazing, I really want to know you passed this Text is how
  •  Tags:  
  • C#
  • Related