Nothing
How do I use Nothing
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: NetworkingPeer.cs
Copy
395 /// Complete disconnect from photon (and the open master OR game server)
397 public override void Disconnect()
398 {
399 if (this.PeerState == PeerStateValue.Disconnected)
400 {
401 if (!PhotonHandler.AppQuits)
402 {
403 Debug.LogWarning(string.Format("Can't execute Disconnect() while not connected. Nothing changed. State: {0}", this.State));
404 }
405 return;
406 }
407
408 this.State = global::PeerState.Disconnecting;
409 base.Disconnect();
410
411 //this.LeftRoomCleanup();
412 //this.LeftLobbyCleanup();
413 }
File name: GCPlayer.cs
Copy
76 public void OnInputEvent(InputActionType action) {
77 switch (action) {
78 case InputActionType.GRAB_PIECE:
79 Node gNode = Finder.RayHitFromScreen
80 if (gNode == null) break;
81 piece = gNode.Piece;
82 if (piece == null) break;
83 if (!piece.IsReady) break;
84 if (Click(gNode) && piece && Has(piece) && Click(piece)) {
85 piece.Pickup();
86 piece.Compute();
87 piece.HighlightPossibleMoves();
88 piece.HighlightPossibleEats();
89 GameManager.Instance.GameState.Grab();
90 }
91
92 //check clickable for tile and piece then pass Player
93 //check if player has piece - PIECE
94 //check if player has piece if not empty - NODE
95 break;
96 case InputActionType.CANCEL_PIECE:
97 if (piece != null) {
98 //if (!piece.IsReady) break;
99 piece.Drop();
100 piece = null;
101 GameManager.Instance.GameState.Cancel();
102 }
103 break;
104 case InputActionType.PLACE_PIECE:
105 Node tNode = Finder.RayHitFromScreen
106 if (tNode == null) break;
107 Piece tPiece = tNode.Piece;
108 if (tPiece == null) {
109 if (piece.IsPossibleMove(tNode)) {
110 if (Rules.IsCheckMove(this,piece,tNode, true)) {
111 Debug.Log("Move checked"); // do nothing
112 } else {
113 piece.MoveToXZ(tNode, Drop);
114 GameManager.Instance.GameState.Place();
115 }
116 }
117 } else {
118 if (piece.IsPossibleEat(tNode)) {
119 if (Rules.IsCheckEat(this,piece,tNode, true)) {
120 Debug.Log("Eat checked"); // do nothing
121 } else {
122 GCPlayer oppPlayer = GameManager.Instance.Opponent(this);
123 oppPlayer.RemovePiece(tPiece);
124 AddEatenPieces(tPiece);
125 tPiece.ScaleOut(0.2f, 1.5f);
126 piece.MoveToXZ(tNode, Drop);
127 GameManager.Instance.GameState.Place();
128 }
129 }
130 }
131 break;
132 }
133 }
File name: frmCustomerOrders.cs
Copy
28 private void Button7_Click(object sender, EventArgs e)
29 {
30 if (DataGridView3.DataSource == null)
31 {
32 MessageBox.Show("Sorry nothing to export into excel sheet..", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
33 return;
34 }
35 int rowsTotal = 0;
36 int colsTotal = 0;
37 int I = 0;
38 int j = 0;
39 int iC = 0;
40 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
41 Excel.Application xlApp = new Excel.Application();
42
43 try
44 {
45 Excel.Workbook excelBook = xlApp.Workbooks.Add();
46 Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelBook.Worksheets[1];
47 xlApp.Visible = true;
48
49 rowsTotal = DataGridView3.RowCount;
50 colsTotal = DataGridView3.Columns.Count - 1;
51 var _with1 = excelWorksheet;
52 _with1.Cells.Select();
53 _with1.Cells.Delete();
54 for (iC = 0; iC <= colsTotal; iC++)
55 {
56 _with1.Cells[1, iC + 1].Value = DataGridView3.Columns[iC].HeaderText;
57 }
58 for (I = 0; I <= rowsTotal - 1; I++)
59 {
60 for (j = 0; j <= colsTotal; j++)
61 {
62 _with1.Cells[I + 2, j + 1].value = DataGridView3.Rows[I].Cells[j].Value;
63 }
64 }
65 _with1.Rows["1:1"].Font.FontStyle = "Bold";
66 _with1.Rows["1:1"].Font.Size = 12;
67
68 _with1.Cells.Columns.AutoFit();
69 _with1.Cells.Select();
70 _with1.Cells.EntireColumn.AutoFit();
71 _with1.Cells[1, 1].Select();
72 }
73 catch (Exception ex)
74 {
75 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
76 }
77 finally
78 {
79 //RELEASE ALLOACTED RESOURCES
80 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
81 xlApp = null;
82 }
83 }
File name: frmCustomerOrders.cs
Copy
223 private void Button3_Click(object sender, EventArgs e)
224 {
225 if (DataGridView1.DataSource == null)
226 {
227 MessageBox.Show("Sorry nothing to export into excel sheet..", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
228 return;
229 }
230 int rowsTotal = 0;
231 int colsTotal = 0;
232 int I = 0;
233 int j = 0;
234 int iC = 0;
235 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
236 Excel.Application xlApp = new Excel.Application();
237
238 try
239 {
240 Excel.Workbook excelBook = xlApp.Workbooks.Add();
241 Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelBook.Worksheets[1];
242 xlApp.Visible = true;
243
244 rowsTotal = DataGridView1.RowCount;
245 colsTotal = DataGridView1.Columns.Count - 1;
246 var _with1 = excelWorksheet;
247 _with1.Cells.Select();
248 _with1.Cells.Delete();
249 for (iC = 0; iC <= colsTotal; iC++)
250 {
251 _with1.Cells[1, iC + 1].Value = DataGridView1.Columns[iC].HeaderText;
252 }
253 for (I = 0; I <= rowsTotal - 1; I++)
254 {
255 for (j = 0; j <= colsTotal; j++)
256 {
257 _with1.Cells[I + 2, j + 1].value = DataGridView1.Rows[I].Cells[j].Value;
258 }
259 }
260 _with1.Rows["1:1"].Font.FontStyle = "Bold";
261 _with1.Rows["1:1"].Font.Size = 12;
262
263 _with1.Cells.Columns.AutoFit();
264 _with1.Cells.Select();
265 _with1.Cells.EntireColumn.AutoFit();
266 _with1.Cells[1, 1].Select();
267 }
268 catch (Exception ex)
269 {
270 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
271 }
272 finally
273 {
274 //RELEASE ALLOACTED RESOURCES
275 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
276 xlApp = null;
277 }
278 }
File name: frmCustomersRecord.cs
Copy
85 private void Button3_Click(object sender, EventArgs e)
86 {
87 if (dataGridView1.DataSource == null)
88 {
89 MessageBox.Show("Sorry nothing to export into excel sheet..", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
90 return;
91 }
92 int rowsTotal = 0;
93 int colsTotal = 0;
94 int I = 0;
95 int j = 0;
96 int iC = 0;
97 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
98 Excel.Application xlApp = new Excel.Application();
99
100 try
101 {
102 Excel.Workbook excelBook = xlApp.Workbooks.Add();
103 Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelBook.Worksheets[1];
104 xlApp.Visible = true;
105
106 rowsTotal = dataGridView1.RowCount;
107 colsTotal = dataGridView1.Columns.Count - 1;
108 var _with1 = excelWorksheet;
109 _with1.Cells.Select();
110 _with1.Cells.Delete();
111 for (iC = 0; iC <= colsTotal; iC++)
112 {
113 _with1.Cells[1, iC + 1].Value = dataGridView1.Columns[iC].HeaderText;
114 }
115 for (I = 0; I <= rowsTotal - 1; I++)
116 {
117 for (j = 0; j <= colsTotal; j++)
118 {
119 _with1.Cells[I + 2, j + 1].value = dataGridView1.Rows[I].Cells[j].Value;
120 }
121 }
122 _with1.Rows["1:1"].Font.FontStyle = "Bold";
123 _with1.Rows["1:1"].Font.Size = 12;
124
125 _with1.Cells.Columns.AutoFit();
126 _with1.Cells.Select();
127 _with1.Cells.EntireColumn.AutoFit();
128 _with1.Cells[1, 1].Select();
129 }
130 catch (Exception ex)
131 {
132 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
133 }
134 finally
135 {
136 //RELEASE ALLOACTED RESOURCES
137 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
138 xlApp = null;
139 }
140 }
File name: frmCustomersRecord1.cs
Copy
103 private void Button3_Click(object sender, EventArgs e)
104 {
105 if (dataGridView1.DataSource == null)
106 {
107 MessageBox.Show("Sorry nothing to export into excel sheet..", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
108 return;
109 }
110 int rowsTotal = 0;
111 int colsTotal = 0;
112 int I = 0;
113 int j = 0;
114 int iC = 0;
115 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
116 Excel.Application xlApp = new Excel.Application();
117
118 try
119 {
120 Excel.Workbook excelBook = xlApp.Workbooks.Add();
121 Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelBook.Worksheets[1];
122 xlApp.Visible = true;
123
124 rowsTotal = dataGridView1.RowCount;
125 colsTotal = dataGridView1.Columns.Count - 1;
126 var _with1 = excelWorksheet;
127 _with1.Cells.Select();
128 _with1.Cells.Delete();
129 for (iC = 0; iC <= colsTotal; iC++)
130 {
131 _with1.Cells[1, iC + 1].Value = dataGridView1.Columns[iC].HeaderText;
132 }
133 for (I = 0; I <= rowsTotal - 1; I++)
134 {
135 for (j = 0; j <= colsTotal; j++)
136 {
137 _with1.Cells[I + 2, j + 1].value = dataGridView1.Rows[I].Cells[j].Value;
138 }
139 }
140 _with1.Rows["1:1"].Font.FontStyle = "Bold";
141 _with1.Rows["1:1"].Font.Size = 12;
142
143 _with1.Cells.Columns.AutoFit();
144 _with1.Cells.Select();
145 _with1.Cells.EntireColumn.AutoFit();
146 _with1.Cells[1, 1].Select();
147 }
148 catch (Exception ex)
149 {
150 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
151 }
152 finally
153 {
154 //RELEASE ALLOACTED RESOURCES
155 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
156 xlApp = null;
157 }
158 }
File name: frmCustomersRecord2.cs
Copy
110 private void Button3_Click(object sender, EventArgs e)
111 {
112 if (dataGridView1.DataSource == null)
113 {
114 MessageBox.Show("Sorry nothing to export into excel sheet..", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
115 return;
116 }
117 int rowsTotal = 0;
118 int colsTotal = 0;
119 int I = 0;
120 int j = 0;
121 int iC = 0;
122 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
123 Excel.Application xlApp = new Excel.Application();
124
125 try
126 {
127 Excel.Workbook excelBook = xlApp.Workbooks.Add();
128 Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelBook.Worksheets[1];
129 xlApp.Visible = true;
130
131 rowsTotal = dataGridView1.RowCount;
132 colsTotal = dataGridView1.Columns.Count - 1;
133 var _with1 = excelWorksheet;
134 _with1.Cells.Select();
135 _with1.Cells.Delete();
136 for (iC = 0; iC <= colsTotal; iC++)
137 {
138 _with1.Cells[1, iC + 1].Value = dataGridView1.Columns[iC].HeaderText;
139 }
140 for (I = 0; I <= rowsTotal - 1; I++)
141 {
142 for (j = 0; j <= colsTotal; j++)
143 {
144 _with1.Cells[I + 2, j + 1].value = dataGridView1.Rows[I].Cells[j].Value;
145 }
146 }
147 _with1.Rows["1:1"].Font.FontStyle = "Bold";
148 _with1.Rows["1:1"].Font.Size = 12;
149
150 _with1.Cells.Columns.AutoFit();
151 _with1.Cells.Select();
152 _with1.Cells.EntireColumn.AutoFit();
153 _with1.Cells[1, 1].Select();
154 }
155 catch (Exception ex)
156 {
157 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
158 }
159 finally
160 {
161 //RELEASE ALLOACTED RESOURCES
162 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
163 xlApp = null;
164 }
165 }
File name: frmSalesRecord1.cs
Copy
35 private void Button3_Click(object sender, EventArgs e)
36 {
37 if (DataGridView1.DataSource == null)
38 {
39 MessageBox.Show("Sorry nothing to export into excel sheet..", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
40 return;
41 }
42 int rowsTotal = 0;
43 int colsTotal = 0;
44 int I = 0;
45 int j = 0;
46 int iC = 0;
47 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
48 Excel.Application xlApp = new Excel.Application();
49
50 try
51 {
52 Excel.Workbook excelBook = xlApp.Workbooks.Add();
53 Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelBook.Worksheets[1];
54 xlApp.Visible = true;
55
56 rowsTotal = DataGridView1.RowCount;
57 colsTotal = DataGridView1.Columns.Count - 1;
58 var _with1 = excelWorksheet;
59 _with1.Cells.Select();
60 _with1.Cells.Delete();
61 for (iC = 0; iC <= colsTotal; iC++)
62 {
63 _with1.Cells[1, iC + 1].Value = DataGridView1.Columns[iC].HeaderText;
64 }
65 for (I = 0; I <= rowsTotal - 1; I++)
66 {
67 for (j = 0; j <= colsTotal; j++)
68 {
69 _with1.Cells[I + 2, j + 1].value = DataGridView1.Rows[I].Cells[j].Value;
70 }
71 }
72 _with1.Rows["1:1"].Font.FontStyle = "Bold";
73 _with1.Rows["1:1"].Font.Size = 12;
74
75 _with1.Cells.Columns.AutoFit();
76 _with1.Cells.Select();
77 _with1.Cells.EntireColumn.AutoFit();
78 _with1.Cells[1, 1].Select();
79 }
80 catch (Exception ex)
81 {
82 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
83 }
84 finally
85 {
86 //RELEASE ALLOACTED RESOURCES
87 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
88 xlApp = null;
89 }
90 }
File name: frmSalesRecord1.cs
Copy
92 private void Button4_Click(object sender, EventArgs e)
93 {
94 if (DataGridView2.DataSource == null)
95 {
96 MessageBox.Show("Sorry nothing to export into excel sheet..", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
97 return;
98 }
99 int rowsTotal = 0;
100 int colsTotal = 0;
101 int I = 0;
102 int j = 0;
103 int iC = 0;
104 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
105 Excel.Application xlApp = new Excel.Application();
106
107 try
108 {
109 Excel.Workbook excelBook = xlApp.Workbooks.Add();
110 Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelBook.Worksheets[1];
111 xlApp.Visible = true;
112
113 rowsTotal = DataGridView2.RowCount;
114 colsTotal = DataGridView2.Columns.Count - 1;
115 var _with1 = excelWorksheet;
116 _with1.Cells.Select();
117 _with1.Cells.Delete();
118 for (iC = 0; iC <= colsTotal; iC++)
119 {
120 _with1.Cells[1, iC + 1].Value = DataGridView2.Columns[iC].HeaderText;
121 }
122 for (I = 0; I <= rowsTotal - 1; I++)
123 {
124 for (j = 0; j <= colsTotal; j++)
125 {
126 _with1.Cells[I + 2, j + 1].value = DataGridView2.Rows[I].Cells[j].Value;
127 }
128 }
129 _with1.Rows["1:1"].Font.FontStyle = "Bold";
130 _with1.Rows["1:1"].Font.Size = 12;
131
132 _with1.Cells.Columns.AutoFit();
133 _with1.Cells.Select();
134 _with1.Cells.EntireColumn.AutoFit();
135 _with1.Cells[1, 1].Select();
136 }
137 catch (Exception ex)
138 {
139 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
140 }
141 finally
142 {
143 //RELEASE ALLOACTED RESOURCES
144 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
145 xlApp = null;
146 }
147 }
File name: frmSalesRecord1.cs
Copy
149 private void Button7_Click(object sender, EventArgs e)
150 {
151 if (DataGridView3.DataSource == null)
152 {
153 MessageBox.Show("Sorry nothing to export into excel sheet..", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
154 return;
155 }
156 int rowsTotal = 0;
157 int colsTotal = 0;
158 int I = 0;
159 int j = 0;
160 int iC = 0;
161 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
162 Excel.Application xlApp = new Excel.Application();
163
164 try
165 {
166 Excel.Workbook excelBook = xlApp.Workbooks.Add();
167 Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelBook.Worksheets[1];
168 xlApp.Visible = true;
169
170 rowsTotal = DataGridView3.RowCount;
171 colsTotal = DataGridView3.Columns.Count - 1;
172 var _with1 = excelWorksheet;
173 _with1.Cells.Select();
174 _with1.Cells.Delete();
175 for (iC = 0; iC <= colsTotal; iC++)
176 {
177 _with1.Cells[1, iC + 1].Value = DataGridView3.Columns[iC].HeaderText;
178 }
179 for (I = 0; I <= rowsTotal - 1; I++)
180 {
181 for (j = 0; j <= colsTotal; j++)
182 {
183 _with1.Cells[I + 2, j + 1].value = DataGridView3.Rows[I].Cells[j].Value;
184 }
185 }
186 _with1.Rows["1:1"].Font.FontStyle = "Bold";
187 _with1.Rows["1:1"].Font.Size = 12;
188
189 _with1.Cells.Columns.AutoFit();
190 _with1.Cells.Select();
191 _with1.Cells.EntireColumn.AutoFit();
192 _with1.Cells[1, 1].Select();
193 }
194 catch (Exception ex)
195 {
196 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
197 }
198 finally
199 {
200 //RELEASE ALLOACTED RESOURCES
201 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
202 xlApp = null;
203 }
204 }
Nothing 130 lượt xem
Gõ tìm kiếm nhanh...