小编Ama*_*tra的帖子

如何将timespan变量更改为整数类型?

我正在尝试使用'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)

我的目标是在文本框中动态显示两个时间戳的时间变化,即它们之间的分钟差应自动显示在文本框中.

c# casting timer datepicker dynamic-data

18
推荐指数
1
解决办法
6万
查看次数

如何让两个下拉列表并排显示?

我一直试图让两个下拉列表并排显示,但无法弄清楚。要设置什么 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)

html css formatting drop-down-menu

3
推荐指数
1
解决办法
4万
查看次数

如何在c#中导出注册表

我一直在尝试将注册表文件导出并保存到任意位置,代码正在运行.但是,在指定路径和保存时,该功能不起作用,也不会导出注册表.也没有显示错误.

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# registry command-line export

2
推荐指数
2
解决办法
7053
查看次数