Regular
How do I use Regular
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: ChatGui.cs
Copy
95 public void Update()
96 {
97 if (this.chatClient != null)
98 {
99 this.chatClient.Service(); // make sure to call this regularly! it limits effort internally, so calling often is ok!
100 }
101 }
File name: ChatClient.cs
Copy
174 public void Service()
175 {
176 if (this.HasPeer && (Environment.TickCount - msTimestampOfLastServiceCall > msDeltaForServiceCalls || msTimestampOfLastServiceCall == 0))
177 {
178 msTimestampOfLastServiceCall = Environment.TickCount;
179 this.chatPeer.Service(); //TODO: make sure to call service regularly. in best case it could be integrated into PhotonHandler.FallbackSendAckThread()!
180 }
181 }
File name: frmColor.cs
Copy
86 private void InitializeComponent()
87 {
88 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ColorInput));
89 this.Blue = new System.Windows.Forms.TextBox();
90 this.label4 = new System.Windows.Forms.Label();
91 this.Green = new System.Windows.Forms.TextBox();
92 this.label3 = new System.Windows.Forms.Label();
93 this.Red = new System.Windows.Forms.TextBox();
94 this.label2 = new System.Windows.Forms.Label();
95 this.label1 = new System.Windows.Forms.Label();
96 this.Cancel = new System.Windows.Forms.Button();
97 this.OK = new System.Windows.Forms.Button();
98 this.SuspendLayout();
99 //
100 // Blue
101 //
102 this.Blue.Location = new System.Drawing.Point(103, 112);
103 this.Blue.Name = "Blue";
104 this.Blue.Size = new System.Drawing.Size(100, 20);
105 this.Blue.TabIndex = 17;
106 ////
107 // label4
108 //
109 this.label4.ForeColor = System.Drawing.Color.Blue;
110 this.label4.Location = new System.Drawing.Point(32, 112);
111 this.label4.Name = "label4";
112 this.label4.Size = new System.Drawing.Size(32, 16);
113 this.label4.TabIndex = 16;
114 this.label4.Text = "Blue";
115 // //
116 // // Green
117 // //
118 this.Green.Location = new System.Drawing.Point(103, 80);
119 this.Green.Name = "Green";
120 this.Green.Size = new System.Drawing.Size(100, 20);
121 this.Green.TabIndex = 15;
122 //
123 // // label3
124 // //
125 this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));
126 this.label3.Location = new System.Drawing.Point(32, 80);
127 this.label3.Name = "label3";
128 this.label3.Size = new System.Drawing.Size(32, 16);
129 this.label3.TabIndex = 14;
130 this.label3.Text = "Green";
131 //
132 // // Red
133 // //
134 this.Red.Location = new System.Drawing.Point(103, 48);
135 this.Red.Name = "Red";
136 this.Red.Size = new System.Drawing.Size(100, 20);
137 this.Red.TabIndex = 13;
138 // //
139 // // label2
140 // //
141 this.label2.ForeColor = System.Drawing.Color.Red;
142 this.label2.Location = new System.Drawing.Point(32, 48);
143 this.label2.Name = "label2";
144 this.label2.Size = new System.Drawing.Size(32, 16);
145 this.label2.TabIndex = 12;
146 this.label2.Text = "Red";
147 //
148 // // label1
149 // //
150 this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
151 this.label1.ForeColor = System.Drawing.Color.Blue;
152 this.label1.Location = new System.Drawing.Point(16, 16);
153 this.label1.Name = "label1";
154 this.label1.Size = new System.Drawing.Size(281, 24);
155 this.label1.TabIndex = 11;
156 this.label1.Text = "Nhập các giá trị màu từ -255 đến 255";
157 // this.label1.Click += new System.EventHandler(this.label1_Click);
158 // //
159 // // Cancel
160 // //
161 this.Cancel.Location = new System.Drawing.Point(176, 178);
162 this.Cancel.Name = "Cancel";
163 this.Cancel.Size = new System.Drawing.Size(75, 23);
164 this.Cancel.TabIndex = 9;
165 this.Cancel.Text = "Bỏ qua";
166 //
167 // // OK
168 // //
169 this.OK.Location = new System.Drawing.Point(19, 178);
170 this.OK.Name = "OK";
171 this.OK.Size = new System.Drawing.Size(75, 23);
172 this.OK.TabIndex = 10;
173 this.OK.Text = "Đồng ý";
174 // this.OK.Click += new System.EventHandler(this.OK_Click);
175 //
176 // ColorInput
177 //
178 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
179 this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
180 this.ClientSize = new System.Drawing.Size(309, 226);
181 this.Controls.Add(this.Blue);
182 this.Controls.Add(this.label4);
183 this.Controls.Add(this.Green);
184 this.Controls.Add(this.label3);
185 this.Controls.Add(this.Red);
186 this.Controls.Add(this.label2);
187 this.Controls.Add(this.label1);
188 this.Controls.Add(this.OK);
189 this.Controls.Add(this.Cancel);
190 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
191 this.Name = "ColorInput";
192 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
193 this.Text = "CHON MAU";
194 //this.Load += new System.EventHandler(this.ColorInput_Load);
195 this.ResumeLayout(false);
196 this.PerformLayout();
197
198 }
File name: frmCustomerRegistration.cs
Copy
168 private void Email_Address_Validating(object sender, CancelEventArgs e)
169 {
170 System.Text.RegularExpressions.Regex rEMail = new System.Text.RegularExpressions.Regex(@"^[a-zA-Z][\w\.-]{2,28}[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$");
171 if (txtEmail_Address.Text.Length > 0)
172 {
173 if (!rEMail.IsMatch(txtEmail_Address.Text))
174 {
175 MessageBox.Show("invalid email address", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
176 txtEmail_Address.SelectAll();
177 e.Cancel = true;
178 }
179 }
180 }
File name: frmCustomerRegistration.cs
Copy
187 private void Username_Validating(object sender, CancelEventArgs e)
188 {
189 System.Text.RegularExpressions.Regex rEMail = new System.Text.RegularExpressions.Regex("^[a-zA-Z0-9_]");
190 if (txtUsername.Text.Length > 0)
191 {
192 if (!rEMail.IsMatch(txtUsername.Text))
193 {
194 MessageBox.Show("only letters,numbers and underscore is allowed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
195 txtUsername.SelectAll();
196 e.Cancel = true;
197 }
198 }
199 }
File name: frmRegistration.cs
Copy
193 private void Email_Address_Validating(object sender, CancelEventArgs e)
194 {
195 System.Text.RegularExpressions.Regex rEMail = new System.Text.RegularExpressions.Regex(@"^[a-zA-Z][\w\.-]{2,28}[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$");
196 if (txtEmail_Address.Text.Length > 0)
197 {
198 if (!rEMail.IsMatch(txtEmail_Address.Text))
199 {
200 MessageBox.Show("invalid email address", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
201 txtEmail_Address.SelectAll();
202 e.Cancel = true;
203 }
204 }
205 }
File name: frmRegistration.cs
Copy
212 private void Username_Validating(object sender, CancelEventArgs e)
213 {
214 System.Text.RegularExpressions.Regex rEMail = new System.Text.RegularExpressions.Regex("^[a-zA-Z0-9_]");
215 if (txtUsername.Text.Length > 0)
216 {
217 if (!rEMail.IsMatch(txtUsername.Text))
218 {
219 MessageBox.Show("only letters,numbers and underscore is allowed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
220 txtUsername.SelectAll();
221 e.Cancel = true;
222 }
223 }
224 }
File name: frmUpdateCustomerDetails.cs
Copy
27 private void Email_Address_Validating(object sender, CancelEventArgs e)
28 {
29 System.Text.RegularExpressions.Regex rEMail = new System.Text.RegularExpressions.Regex(@"^[a-zA-Z][\w\.-]{2,28}[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$");
30 if (txtEmail_Address.Text.Length > 0)
31 {
32 if (!rEMail.IsMatch(txtEmail_Address.Text))
33 {
34 MessageBox.Show("invalid email address", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
35 txtEmail_Address.SelectAll();
36 e.Cancel = true;
37 }
38 }
39 }
File name: frmUpdateCustomerDetails.cs
Copy
46 private void Username_Validating(object sender, CancelEventArgs e)
47 {
48 System.Text.RegularExpressions.Regex rEMail = new System.Text.RegularExpressions.Regex("^[a-zA-Z0-9_]");
49 if (txtUsername.Text.Length > 0)
50 {
51 if (!rEMail.IsMatch(txtUsername.Text))
52 {
53 MessageBox.Show("only letters,numbers and underscore is allowed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
54 txtUsername.SelectAll();
55 e.Cancel = true;
56 }
57 }
58 }
File name: notepad1.cs
Copy
471 private void normatToolStripMenuItem_Click(object sender, EventArgs e)
472 {
473 FontKlyeMethod(FontStyle.Regular);
474 }
Regular 154 lượt xem
Gõ tìm kiếm nhanh...