小编Son*_*nül的帖子

我正在尝试获取流程信息并获得两个错误我该如何解决它们?

private void ProcessInfo()
        {
            string ffMPEG = System.IO.Path.Combine(Application.StartupPath, "ffMPEG.exe");
            System.Diagnostics.Process mProcess = null;

            System.IO.StreamReader SROutput = null;
            string outPut = "";

            string filepath = "D:\\source.mp4";
            string param = string.Format("-i \"{0}\"", filepath);

            System.Diagnostics.ProcessStartInfo oInfo = null;

            System.Text.RegularExpressions.Regex re = null;
            System.Text.RegularExpressions.Match m = null;
            TimeSpan Duration = 0;

            //Get ready with ProcessStartInfo
            oInfo = new System.Diagnostics.ProcessStartInfo(ffMPEG, param);
            oInfo.CreateNoWindow = true;

            //ffMPEG uses StandardError for its output.
            oInfo.RedirectStandardError = true;
            oInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;          
            oInfo.UseShellExecute = false;

            // Lets start the process

            mProcess …
Run Code Online (Sandbox Code Playgroud)

.net c# winforms

-1
推荐指数
1
解决办法
78
查看次数

使用正则表达式模式并获取CS1003:C#中的语法错误

使用@但仍然是错误:

错误

有谁知道为什么这一行:

String[] values = Regex.Split(line, @",(?! [\w\d\.\[\]\(\)\#\*\-_])(?=([^\"]*\"[^\"]*\")*[^\"]*$)");
Run Code Online (Sandbox Code Playgroud)

错误CS1002; 预期InsertLogtoDatabase D:\ MyProjects\InsertLogWindowsApp\WindowsFormsApplication1\LogOrderi2trade.cs 119

严重级代码说明项目文件行错误CS1003语法错误,','期望InsertLogtoDatabase D:\ MyProjects\InsertLogWindowsApp\WindowsFormsApplication1\LogOrderi2trade.cs 119

c# regex string

-1
推荐指数
1
解决办法
324
查看次数

插入Excel公式时出现异常HRESULT:0x800A03EC

这是我得到的例外:

System.Runtime.InteropServices.COMException(0x800A03EC):来自HRESULT的异常:0x800A03EC

at System.RuntimeType.ForwardCallToInvokeMember(String memberName,BindingFlags flags,Object target,Int32 [] aWrapperTypes,MessageData&msgData)
at Microsoft.Office.Interop.Excel.Range.set_Formula(Object value)

我的代码看起来像这样:

Range rng = activeWorksheet.get_Range("A1");
rng.Formula = "=SUM(A4*C4;A5*C5;A6*C6;A7*C7)/SUM(A4:A7)";
Run Code Online (Sandbox Code Playgroud)

每当我运行此代码时,我都会得到前面提到的异常.但是,当我运行此代码时:

Range rng = activeWorksheet.get_Range("A1");
rng.Formula = "=SUM(A4:A7)/4"
Run Code Online (Sandbox Code Playgroud)

这非常有效.没有例外.

我检查了两个公式,它们在我的Excel中完美运行.我试过设置:

Application.Calculation = XlCalculation.xlCalculationAutomatic;
Run Code Online (Sandbox Code Playgroud)

这根本没有帮助,我一直在谷歌搜索这个解决方案,并没有找到任何有用的东西.有没有人知道可能有什么问题?

c# excel vba

-1
推荐指数
1
解决办法
3048
查看次数

无法在C#中将int类型转换为int,给出错误 - 输入字符串的格式不正确

我想将字符串转换为int.我有像这样的字符串值"45,454,566.00".虽然类型转换抛出错误

输入字符串的格式不正确

int GrandTotalInWords = Int32.Parse(grandtotal);//error
grandTotalInWords.InnerHtml = ConvertNumbertoWords(GrandTotalInWords);
Run Code Online (Sandbox Code Playgroud)

c# int

-1
推荐指数
1
解决办法
60
查看次数

如何将dd/MM/YYYY格式的字符串日期转换为YYYY-MM-dd datetime?

我想将dd/MM/YYYY格式化的字符串日期转换为YYYY-MM-dd日期时间.但它回到我身边

"字符串未被识别为有效的DateTime."

如何将"04/26/2016"字符串转换为yyyy-MM-dd日期时间格式?

 DateTime dt = DateTime.ParseExact("04/26/2016", "yyyy-MM-dd", CultureInfo.InvariantCulture);
 Console.WriteLine(dt);
Run Code Online (Sandbox Code Playgroud)

c# datetime date

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

从mm/yy解析日期格式为mm-yy

我想将MM/YY格式化的字符串日期转换为mm-yy DateTime.并设置为rad蒙版编辑框的值.但它回到我身边

"字符串未被识别为有效的DateTime."

我试过了

DateTime dt = DateTime.ParseExact("11/17", "MMyy", CultureInfo.InvariantCulture);
Run Code Online (Sandbox Code Playgroud)

对于例如,我想转换03/16和radmasked编辑框的设定值伪装成MMyy03-16

.net c# datetime

-1
推荐指数
1
解决办法
1317
查看次数

计算增值税辅助方法

正在网上寻找计算增值税的方法,但似乎找不到。

decimal subTotal = FinalInvoice.Hold_Back_Value;
decimal VAT = //calculate vat at 20% for subtotal using helper method
decimal TOTAL = subtotal + VAT;
Run Code Online (Sandbox Code Playgroud)

c# helper

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

在asp.net中,c#delete query不执行以下错误发生

    s = "delete MAX(id) from emp";

    cmd = new SqlCommand(s, con);

    cmd.ExecuteNonQuery();

    GridView1.DataBind();
Run Code Online (Sandbox Code Playgroud)

错误:'('附近的语法不正确.

当我尝试在运行时错误显示上面执行此查询....enter code here

c# asp.net

-2
推荐指数
1
解决办法
150
查看次数

使用StreamWriter存储在特定路径中

我正在尝试使用StreamWriter指定存储创建文件的位置:

string getCurrentPath = Environment.CurrentDirectory;
StreamWriter writeFile = new StreamWriter(@"" +getCurrentPath + "\\NDependProject\\OceanAPIDependencies.xml");
writeFile.Close();
Run Code Online (Sandbox Code Playgroud)

我收到此错误消息:

    Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a part
 of the path 'D:\Project_Summer\ExtensionDirectoryTraversal\ExtensionDirectoryTr
aversal\bin\Debug\NDependProject\OceanAPIDependencies.xml'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, I
nt32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions o
ptions, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolea
n useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean
bFromProxy, …
Run Code Online (Sandbox Code Playgroud)

.net c# visual-studio-2012

-2
推荐指数
1
解决办法
2323
查看次数

不能隐式地将类型'int'转换为'string'c#

我在我的应用程序中有登录页面,因为我已将我的指定ID保存在Cookies中

Response.Cookies["DesignationID"].Value = ds.Tables[0].Rows[0]["DesignationID"].ToString();
Run Code Online (Sandbox Code Playgroud)

在用户登录之后在另一个页面中我想要检索该cookie值,所以我编写了类似的代码

if (Convert.ToInt32(Request.Cookies["DesignationID"].Value = 2))
Run Code Online (Sandbox Code Playgroud)

但它显示错误,如不能隐式将类型'int'转换为'string'c#,红色虚线在2以下...所以请给我一些提示......

c# asp.net

-2
推荐指数
1
解决办法
6266
查看次数

标签 统计

c# ×10

.net ×3

asp.net ×2

datetime ×2

date ×1

excel ×1

helper ×1

int ×1

regex ×1

string ×1

vba ×1

visual-studio-2012 ×1

winforms ×1