セルが空かどうかを確認してメッセージを保存し、すべてのメッセージを含むすべての行に新しいセルを作成する必要があります
しかし、DevExpressの操作方法がわからないので、誰かが私のコードを手伝ってくれる?
string Name = "First Name";
string FName = "Father Name";
string LName = "Last Name";
string EmpCode = "Employee Code";
string Tax = "Tax#";
string SocSec = "Soc.Sec#";
string EmpType = "Employment Type";
string DepCode = "Department Code";
string DepDesc = "Department Description";
private void simpleButton1_Click(object sender, System.EventArgs e)
{
try
{
OleDbConnection con = new OleDbConnection();
con.ConnectionString = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=C:\\Users\\pc\\Documents\\Emp.xlsx;Extended Properties=\"Excel 12.0;HDR=Yes\"";
con.Open();
DataTable dtSchema;
dtSchema = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
OleDbCommand Command = new OleDbCommand ("select * FROM [" + dtSchema.Rows[0]["TABLE_NAME"].ToString() + "]", con);
OleDbDataAdapter da = new OleDbDataAdapter(Command);
DataSet ds = new DataSet ();
da.Fill(ds);
dataGrid1.DataSource = ds.Tables[0];
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
このループは、空のセルについての正しいメッセージを私に与えていません。私が書いたものは正しくないと思います。別のより良い方法があるかもしれません...
for (int rows = 0 ; rows < gridView3.RowCount ; rows ++)
{
string[] msg = new string[50];
if ((gridView3.GetRowCellValue(rows, gridView3.Columns["LName"])) == null)
{
msg[rows] = "name missing";
}
}