private void Control_KeyUp(object sender, KeyEventArgs e)
{
if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
{
this.SelectNextControl((Control)sender, true, true, true, true);
}
}
private void Control_KeyUp(object sender, KeyEventArgs e)
{
if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
{
this.SelectNextControl((Control)sender, true, true, true, true);
}
}
//code on export to excel button
private void buttonExportExcel_Click(object sender, EventArgs e)
{
SaveFileDialog saveFileDialogExcel = new SaveFileDialog();
saveFileDialogExcel.Filter = "Excel files (*.xlsx)|*.xlsx";
if (saveFileDialogExcel.ShowDialog() == DialogResult.OK)
{
string exportFilePath = saveFileDialogExcel.FileName;
gridControl1.DataSource = selectgridvalues();
gridControl1.ExportToXlsx(exportFilePath);
}
}
var sqlCon= new SqlConnection(Properties.Settings.Default.sString);
var mySQLCon= new MySqlConnection(Properties.Settings.Default.dString);
sqlCon.Open();
mySQLCon.Open();
var temp = mySQLConn.State.ToString();
if (sqlCon.State==ConnectionState.Open && temp=="Open")
{
MessageBox.Show(@"Connection working.");
}
else
{
MessageBox.Show(@"Please check connection string");
}
ASPxGridView1.Columns[0].Caption = "Some Value";
จัดหัวตารางอยู่กึ่งกลาง
int ccount = gridView2.Columns.Count;
for (int i = 0; i <= ccount-1; i++)
{
gridView2.Columns[i].AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center;
gridView2.Columns[i].AppearanceHeader.Options.UseTextOptions = true;
}
// Make the grid read-only. gridView1.OptionsBehavior.Editable = false; // Prevent the focused cell from being highlighted. gridView1.OptionsSelection.EnableAppearanceFocusedCell = false; // Draw a dotted focus rectangle around the entire row. gridView1.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
| Operator | Description | Example |
|---|---|---|
| && | Called Logical AND operator. If both the operands are non zero then condition becomes true. | (A && B) is false. |
| || | Called Logical OR Operator. If any of the two operands is non zero then condition becomes true. | (A || B) is true. |
| ! | Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false. | !(A && B) is true. |
using System; namespace OperatorsAppl { class Program { static void Main(string[] args) { bool a = true; bool b = true; if (a && b) { Console.WriteLine("Line 1 - Condition is true"); } if (a || b) { Console.WriteLine("Line 2 - Condition is true"); } /* lets change the value of a and b */ a = false; b = true; if (a && b) { Console.WriteLine("Line 3 - Condition is true"); } else { Console.WriteLine("Line 3 - Condition is not true"); } if (!(a && b)) { Console.WriteLine("Line 4 - Condition is true"); } Console.ReadLine(); } } }