GroupBox
How do I use Group Box
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: frmThi.cs
Copy
184 private void btPre_Click(object sender, EventArgs e)
185 {
186 iRows -= sodonghienlen;
187 getData(iRows);
188 if (i < 100 && i > 1)
189 {
190 i--;
191 groupBox1.Text = " Nội dung câu hỏi " + i.ToString();
192 }
193 else
194 return;
195 }
File name: frmThi.cs
Copy
197 private void btNext_Click(object sender, EventArgs e)
198 {
199 test();
200 getdapan();
201 iRows += sodonghienlen;
202 getData(iRows);
203 if (i < 1)
204 return;
205 else
206 {
207 //strsoluongcauhoi1 = frmluachon.strsoluongcauhoi;
208 i++;
209 if (int.Parse(strsoluongcauhoi1)< i)
210 {
211 groupBox1.Text = " Nội dung câu hỏi " + i.ToString();
212 if (MessageBox.Show("Bạn đã làm xong","Thông báo",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning)== DialogResult.OK)
213 {
214
215 }
216 }
217 else
218 {
219 groupBox1.Text = " Nội dung câu hỏi " + i.ToString();
220 }
221 }
222 j = j + 1;
223 }
File name: frmThiThat.cs
Copy
135 void LoadCauHoiVaoControl()
136 {
137
138 try
139 {
140 groupBox1.Text = "Câu: " + (CauHienTai + 1).ToString();
141 lbCauHoi.Text = BangDeThi.Rows[CauHienTai][1].ToString();
142 lbA.Text = BangDeThi.Rows[CauHienTai][2].ToString();
143 lbB.Text = BangDeThi.Rows[CauHienTai][3].ToString();
144 lbC.Text = BangDeThi.Rows[CauHienTai][4].ToString();
145 lbD.Text = BangDeThi.Rows[CauHienTai][5].ToString();
146
147 if (BangDeThi.Rows[CauHienTai][7].ToString().Contains("A"))
148 checkBox1.Checked = true;
149 if (BangDeThi.Rows[CauHienTai][7].ToString().Contains("B"))
150 checkBox2.Checked = true;
151 if (BangDeThi.Rows[CauHienTai][7].ToString().Contains("C"))
152 checkBox3.Checked = true;
153 if (BangDeThi.Rows[CauHienTai][7].ToString().Contains("D"))
154 checkBox4.Checked = true;
155 }
156 catch (Exception ex)
157 { MessageBox.Show(ex.Message); }
158 }
File name: frmReturn.cs
Copy
96 private void btnreturn_save_Click(object sender, EventArgs e)
97 {
98 string tranid;
99
100 config.singleResult("SELECT concat(STRT,END) FROM tblautonumber WHERE ID = 6");
101 tranid = config.dt.Rows[0].Field
102
103 if (txttransactionid.Text == "")
104 {
105 MessageBox.Show("There are empty fields left that must be fill up!", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
106 return;
107 }
108 if (dtCus_addedlist.RowCount == 0)
109 {
110 MessageBox.Show("Cart is empty!", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
111 return;
112 }
113
114 sql = "SELECT `ITEMID`, `QTY` FROM `tblstock_in_out` WHERE `TRANSACTIONNUMBER` ='" + txttransactionid.Text + "'";
115 config.singleResult(sql);
116
117 foreach (DataRow row in config.dt.Rows)
118 {
119 for (int i = 0; i < dtCus_addedlist.Rows.Count; i++)
120 {
121 if (dtCus_addedlist.Rows[i].Cells[0].Value.ToString() == row.Field
122 {
123 if (int.Parse(dtCus_addedlist.Rows[i].Cells[4].Value.ToString()) > row.Field
124 {
125 MessageBox.Show("The returned quantity of the item ( " + dtCus_addedlist.Rows[i].Cells[1].Value.ToString() + " ) is greater than the available quantity of it.", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
126 return;
127 }
128 }
129 if (dtCus_addedlist.Rows[i].Cells[4].Value.ToString() == "")
130 {
131 MessageBox.Show("Set your purpose.", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
132 return;
133 }
134 }
135 }
136
137 foreach (DataGridViewRow r in dtCus_addedlist.Rows)
138 {
139 sql = "INSERT INTO `tblstock_return` ( `STOCKRETURNNUMBER`, `ITEMID`, `RETURNDATE`, `QTY`, `TOTALPRICE`, `OWNER_CUS_ID`)" +
140 " VALUES ('" + tranid + "','" + r.Cells[0].Value + "','" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + r.Cells[4].Value +
141 "','" + r.Cells[5].Value + "','" + custormerid + "')";
142 config.Execute_Query(sql);
143
144 // '-----------------------------------------------update item
145 sql = "UPDATE `tblitems` SET `QTY`=`QTY` + '" + r.Cells[4].Value + "' WHERE ITEMID='" + r.Cells[0].Value + "'";
146 config.Execute_Query(sql);
147
148 sql = "UPDATE `tblstock_in_out` SET `QTY`=`QTY`-'" + r.Cells[4].Value + "', `TOTALPRICE`=`TOTALPRICE`-'" + r.Cells[5].Value + "' WHERE `STOCKOUTID` ='" + r.Cells[6].Value + "'";
149 config.Execute_Query(sql);
150 }
151
152
153 sql = "INSERT INTO `tbltransaction` (`TRANSACTIONNUMBER`, `TRANSACTIONDATE`, `TYPE`, `SUPLIERCUSTOMERID`)" +
154 " VALUES ('" + txttransactionid.Text + "','" + DateTime.Now.ToString("yyyy-MM-dd") + "','Returned','" + custormerid + "')";
155 config.Execute_Query(sql);
156
157 // '-----------------------------------------------update autonumber
158 config.Execute_Query("UPDATE tblautonumber SET END= END + INCREMENT WHERE ID = 6");
159
160 // '------------------------------------------------------------
161 MessageBox.Show("Item(s) has been returned in the database.");
162 // '------------------------------------------------------------clearing
163 funct.clearTxt(GroupBox3);
164 dtCus_addedlist.Rows.Clear();
165
166 frmReturn_Load(sender, e);
167 }
File name: frmQlMuonSach.cs
Copy
128 private void btnclear_Click(object sender, EventArgs e)
129 {
130 foreach (Control ctr in groupBox1.Controls)
131 {
132 if (ctr is TextBox || ctr is ComboBox)
133 {
134 ctr.Text = "";
135 cbxTenSach.Focus();
136 txtMuon.Text = date.ToString("dd/MM/yyyy");
137 txtTra.Text = date.AddDays(7).ToString("dd/MM/yyyy");
138 }
139 }
140 }
File name: frmQLThe.cs
Copy
72 private void btnclear_Click(object sender, EventArgs e)
73 {
74 foreach (Control ctr in groupBox1.Controls)
75 {
76 if (ctr is TextBox || ctr is ComboBox || ctr is MaskedTextBox)
77 {
78 ctr.Text = "";
79 }
80 }
81 cbxMaDG.Focus();
82 txtMaThe.ReadOnly = false;
83 mklNgayCap.Text = date.ToString("dd/MM/yyyy");
84 mktHan.Text = date.AddYears(1).ToString("dd/MM/yyyy");
85 }
File name: frmQLTraSach.cs
Copy
56 private void btnclear_Click(object sender, EventArgs e)
57 {
58 foreach (Control ctr in groupBox1.Controls)
59 {
60 if (ctr is TextBox || ctr is ComboBox || ctr is MaskedTextBox)
61 {
62 ctr.Text = "";
63 }
64 }
65 cbxTenSach.Focus();
66 }
File name: frmQLUser.cs
Copy
59 private void groupBox1_Enter(object sender, EventArgs e)
60 {
61
62 }
File name: frmQLUser.cs
Copy
64 private void btnclear_Click(object sender, EventArgs e)
65 {
66 foreach (Control ctr in groupBox1.Controls)
67 {
68 if (ctr is TextBox)
69 ctr.Text = "";
70 }
71 TxTReadOnly(false);
72 txtusername.Focus();
73 }
File name: frmSach.cs
Copy
145 private void btnclear_Click(object sender, EventArgs e)
146 {
147 foreach (Control ctr in groupBox1.Controls)
148 {
149 if (ctr is TextBox && ctr is ComboBox)
150 {
151 ctr.Text = "";
152 }
153 }
154 cbxtensach.Focus();
155 }
GroupBox 101 lượt xem
Gõ tìm kiếm nhanh...