小编Jon*_*han的帖子

如何使用Dir中的名称文件在C#上填充组合框?

我希望你能帮我解决这个问题.

我一直在尝试使用特定目录的名称文件填充组合框.这个DIR将始终相同,因此它将始终是相同的例程.

有任何想法吗?

干杯!

c# directory combobox

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

WPF Datagrid.获取所选行的每个单元格的值

我正在使用WPF工具包DataGrid.

如何获取所选行的单元格值?

wpf wpftoolkit wpfdatagrid

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

Team Foundation Server,电子书或起点

我想学习如何使用TFS2010,但我找不到最新的电子书.你能给我一些建议吗,或者你能指导我开始有关这个主题的资源/教程吗?

tfs tfs2010

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

VBA中"with"子句令人讨厌的问题

我正在使用此函数来替换word文档中的某些字符串.这个功能很好用

Sub reemplazar(doc As Word.Document, after As String, before As String, replaceall As Boolean)
    With doc.Content.Find
        .Text = after 
        .Replacement.Text = before 
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        If replaceall Then
            .Execute replace:=wdReplaceAll
        Else
            .Execute replace:=wdReplaceOne
    End If
    End With
End Sub
Run Code Online (Sandbox Code Playgroud)

但是......我不知道为什么如果我以这种方式重写函数它就会停止工作.没有错误或警告,但没有更换.

Sub reemplazar(doc As Word.Document, after As String, before As String, replaceall As Boolean)
    doc.Content.Find.Text = after 
    doc.Content.Find.Replacement.Text = before …
Run Code Online (Sandbox Code Playgroud)

ms-access vba

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

帮助Linq和Generics.在Query中使用GetValue

我正在试图创建一个函数,在基于属性和值的查询中添加'where'子句.这是我的函数的一个非常简单的版本.

Private Function simplified(ByVal query As IQueryable(Of T), ByVal PValue As Long, ByVal p As PropertyInfo) As ObjectQuery(Of T)

    query = query.Where(Function(c) DirectCast(p.GetValue(c, Nothing), Long) = PValue)
    Dim t = query.ToList 'this line is only for testing, and here is the error raise
    Return query

End Function
Run Code Online (Sandbox Code Playgroud)

错误消息是:LINQ to Entities无法识别方法'System.Object CompareObjectEqual(System.Object,System.Object,Boolean)'方法,并且此方法无法转换为商店表达式.

看起来像是不能在linq查询中使用GetValue.我能以其他方式实现这一目标吗?

在C#/ VB中发布您的答案.选择让你感觉更舒适的那个.

谢谢

编辑:我也尝试了相同的结果

Private Function simplified2(ByVal query As IQueryable(Of T))

    query = From q In query
            Where q.GetType.GetProperty("Id").GetValue(q, Nothing).Equals(1)
            Select q
    Dim t = query.ToList
    Return …
Run Code Online (Sandbox Code Playgroud)

linq vb.net generics linq-to-entities

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

ItextSharp支持HTML和CSS

我知道ItextSharp在HTML和CSS解析方面有一些重要的限制.

我正在寻找一些文件或帖子,告诉我这个限制,而不是测试每个可能的功能,并交叉我的手指.

我可以使用哪些CSS样式?怎么表明我这样做?

这同样适用于HTML.今天早上mi应用程序崩溃,因为我正在使用<hr />标签,ItextSharp似乎不支持.

我一直在寻找这样的文件,但我没有找到任何东西.

谢谢.

html css itext

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

C#中的选项卡式用户界面

我想创建一个简单的选项卡式界面应用程序.我之前在WPF中使用每个选项卡中的usercontrol完成了它,并且我与主要表单进行通信,搜索父元素(表单或选项卡控件)

我怎么能在WinForms中做同样的事情?我需要在每个标签内放置哪个元素?

谢谢.

c# user-interface interface tabbed-interface winforms

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

LinQ的不同形式

string grid = @"08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08";
string[] res = grid.Split(' ');

var lowNums = from n in res
              where n.Length > 0
              select int.Parse(n);
Run Code Online (Sandbox Code Playgroud)

我无法将上述linQ语句转换为lambda WHERE等效语句.以下工作,但只返回上午,enumernable<string>而我想要一个enumerable<int>:

IEnumerable<string> all = res.Where(x => x.Length > 0);
Run Code Online (Sandbox Code Playgroud)

c# linq

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

Asp.NET MVC中TextBoxFor()的FormatString

  • 如何为文本框指定MaxLength,如MaxLenth ="18"

  • 如何在模型中将TextBox格式字符串设置为FormatString ="$ ###,###,###,## 0.00",这样即使我输入100,它也应自动变为$ 100.00

asp.net-mvc textbox

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

如何在MVC3的自定义路由处理程序中指定命名空间?

我写了一个自定义路由处理程序.因为我的网站中的区域中存在冲突的控制器名称,所以我收到错误:找到了多个匹配控制器命名的类型...

我想我需要在我的处理程序中指定一个命名空间,对吧?

我尝试了以下,没有一个工作:

public class MyRouteHandler : MvcRouteHandler
{
    protected override IHttpHandler GetHttpHandler(RequestContext requestContext)
    {

        (... complicated DB lookups and "re-writing" of requestContext.RouteData.Values["controller"] ...)

        // doesn't work
        requestContext.RouteData.Values["namespaces"] = new[] { "Site.Contollers" };

        // doesn't work
        requestContext.RouteData.DataTokens.Add("namespaces", new[] { "Site.Contollers" });

        // doesn't work
        requestContext.RouteData.Values["namespaces"] = "Site.Contollers";

        // doesn't work
        requestContext.RouteData.DataTokens.Add("namespaces", "Site.Contollers");

        (... snip ...)

        return base.GetHttpHandler(requestContext);
    }
}
Run Code Online (Sandbox Code Playgroud)

什么是正确的方法?

注意:因为我的处理程序执行数据库查找并根据结果选择不同的控制器,所以我不能在我的Global.asax.cs文件中使用基本的MapRoute()方法(据我所知).

asp.net-mvc namespaces mvcroutehandler asp.net-mvc-routing asp.net-mvc-areas

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