我正在尝试使用'parse'将timespan变量转换为整数变量.我收到一条错误消息:
格式异常未处理:输入字符串格式不正确
这是代码有:
private void dateTimePicker4_ValueChanged(object sender, EventArgs e)
{
TimeSpan t = dateTimePicker4.Value.ToLocalTime() - dateTimePicker3.Value.ToLocalTime();
int x = int.Parse(t.ToString());
y = x;
}
Run Code Online (Sandbox Code Playgroud)
我的目标是在文本框中动态显示两个时间戳的时间变化,即它们之间的分钟差应自动显示在文本框中.
我一直试图让两个下拉列表并排显示,但无法弄清楚。要设置什么 CSS 元素属性来执行此操作。我必须以以下格式显示它:
[company] [mobile]
Run Code Online (Sandbox Code Playgroud)
代替
[company]
[mobile]
Run Code Online (Sandbox Code Playgroud)
有 3 个这样的对。此外,这对 2 个选择下拉框似乎并不坚持其划分。
<html>
<head>
<style>
body
{
background-image:url('gradient1.jpg');
background-repeat:repeat-x;
}
.ex
{
margin:auto;
width:90%;
padding:10px;
border:outset;
}
select
{
display:inline;
cursor:pointer;
}
.ey
{
display:inline;
}
.gap
{
clear:both;
margin-bottom:2px;
}
</style>
</head>
<body>
<div class="ex">
<form id='dd1.mob1' name='dd1.mob1' method='post' action=' '>
<p><label>Select Company</label></p><br/>
<select onchange=filter.submit() name='dd1mob1' id='dd1mob1'>
<option>1</option>
<option>2</option>" . $options . "
</select>
</form>
<form class="ey" id='dd2.mob1' name='dd2.mob1' method='post' action=''>
<p><label>Select Mobile</label></p><br/>
<select onchange=filter.submit() name='dd2mob1' id='dd2mob1'>
" …Run Code Online (Sandbox Code Playgroud) 我一直在尝试将注册表文件导出并保存到任意位置,代码正在运行.但是,在指定路径和保存时,该功能不起作用,也不会导出注册表.也没有显示错误.
private static void Export(string exportPath, string registryPath)
{
string path = "\""+ exportPath + "\"";
string key = "\""+ registryPath + "\"";
// string arguments = "/e" + path + " " + key + "";
Process proc = new Process();
try
{
proc.StartInfo.FileName = "regedit.exe";
proc.StartInfo.UseShellExecute = false;
//proc.StartInfo.Arguments = string.Format("/e", path, key);
proc = Process.Start("regedit.exe", "/e" + path + " "+ key + "");
proc.WaitForExit();
}
catch (Exception)
{
proc.Dispose();
}
}
Run Code Online (Sandbox Code Playgroud) c# ×2
casting ×1
command-line ×1
css ×1
datepicker ×1
dynamic-data ×1
export ×1
formatting ×1
html ×1
registry ×1
timer ×1