我已经将数据从数据库加载到datagridview并且有两列目标值和体积,其中体积>目标值,体积单元格应为绿色,体积<目标值,然后体积应为红色.我尝试过,但我无法做到.
private void dataGridView1_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
if (dataGridView1.Rows.Count > 0 && dataGridView1.Columns.Count > 0)
{
foreach (DataGridViewRow r in dataGridView1.Rows)
{
if (Volume > target value)
{
cell.Style.BackColor = Color.AliceBlue;
}
Run Code Online (Sandbox Code Playgroud) 我试图只获取文件夹中不包括任何其他目录的文件。但下面的脚本将所有文件和文件夹移动到另一个目录。
while True:
# Go through each of the directories
for mylist in dirlist:
check_dir = mylist[0]
callback = mylist[1]
# get the list of files in the directory
filelist = os.listdir(check_dir)
for this_file in filelist:
if ((this_file == ".") or (this_file == "..") or (this_file == "donecsvfiles") or (this_file == "doneringofiles")):
print "Skipping self and parent"
continue
full_filename = "%s/%s"%(check_dir, this_file)
Run Code Online (Sandbox Code Playgroud) 我有3个文本框值:
no of requests = 2
court fee = 60
claim amount = 200
Run Code Online (Sandbox Code Playgroud)
我的客户要求他们希望展示:
no of requests = 00002; // 5 characters
court fee = 000006000; // 9 characters
claim amount = 0000020000; // 10 characters
Run Code Online (Sandbox Code Playgroud)
我试过这个,但没有得到这些价值观.我不知道我哪里错了.
decimal requests = 0;
decimal CFee = 0;
decimal CLAIMAMT = 0;
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
CFee += Convert.ToDecimal(dataGridView1.Rows[i].Cells["CFee"].Value) / 100 * dataGridView1.RowCount;
CLAIMAMT += Convert.ToDecimal(dataGridView1.Rows[i].Cells["CLAIMAMT"].Value) / 100 ;
requests = Convert.ToInt16(dataGridView1.RowCount.ToString());
}
textBox3.Text = CFee.ToString();//court …Run Code Online (Sandbox Code Playgroud) 我的客户需求具有标题,正文和页脚格式的固定长度文件记录,但在页脚中他们希望有一个1966长的空白空间.我尝试使用不同的butttons作为页眉和页脚和身体,但无法在最后指定空间.这是我的代码..在创建页脚时空间不起作用.
FileStream fs = new FileStream(@"C:\Users\IT-Administrator\Desktop\ee.txt", FileMode.Open, FileAccess.ReadWrite);
fs.Seek(0, SeekOrigin.End);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine(comboBox6.Text + textBox2.Text + textBox3.Text + textBox4.Text + **SPACE(1966)** );
sw.Close();
fs.Close();**strong text**
Run Code Online (Sandbox Code Playgroud) 我知道这很简单,但我无法思考.显示表中记录的计数并将其显示在文本框中.
private void gMapControl1_Load_1(object sender, EventArgs e)
{
SqlConnection conDatabase = new SqlConnection(constring);
conDatabase.Open();
DataTable db = new DataTable();
SqlDataAdapter sda = new SqlDataAdapter(
"select count(site) from [ICPS].[dbo].[excel GPS postcode]",
conDatabase);
sda.Fill(db);
textBox29.Text = ;
SqlDataAdapter sda = new SqlDataAdapter(
"select count(site) from [ICPS].[dbo].[excel GPS postcode] "
+ "where Region = '1'",
conDatabase);
sda.Fill(db);
textBox30.Text = ;
}
Run Code Online (Sandbox Code Playgroud) 有没有办法将组合框值限制为'0',其中我有体积值除以目标值,因为我的目标值是组合框并给我一个误差除以零.我试过这个但不是运气.
private void comboBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsNumber(e.KeyChar) && (e.KeyChar != '0'))
{
e.Handled = true;
}
}
Run Code Online (Sandbox Code Playgroud) c# ×5
winforms ×3
datagridview ×1
directory ×1
file ×1
filestream ×1
python ×1
sql ×1
string ×1