小编stu*_*rtd的帖子

在特定位置抑制 RichTextBox 中的换行符

我需要在 RichTextBox 中抑制一些换行符。

例如,考虑d6+. 6和之间不能有换行符+。基本上我正在寻找类似<nobr>HTML 的东西。

到目前为止,我一直在插入 \u+FEFF 等(在某些机器上工作,但有些显示垂直线,尽管 Windows 标准字体可能是字体问题)。我还尝试直接操作 rtf,即在box.rtf = ...其中放一些\zwnbo,但我似乎从来没有做对。

非常感谢帮助。

.net c# rtf line-breaks richtextbox

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

用于特定域名的电子邮件的正则表达式

这是我的代码:

<asp:RegularExpressionValidator ID="regexEmail" 
     runat="server" ValidationExpression="(\w+@[test]+?\.[com]{3})" 
     ErrorMessage="Please Enter Valid Email Id" 
     ControlToValidate="txtEmailAddress" />
Run Code Online (Sandbox Code Playgroud)

这是行不通的.但我的问题并没有就此结束.我还想知道如何只验证用户名中的字符,而不是数字和特殊字符.

如果有人可以帮助您使用此代码.提前致谢.

c# regex asp.net

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

Visual Studio 上的“文件存在”错误

每当我运行、调试、启动甚至添加按钮时,我都会在 Visual Studio 2015(VB 和 C#)上遇到一个奇怪的错误。它显示“文件存在”,我尝试清除我的临时文件,更改文件名和目标位置,但它仍然无法正常工作。输出窗口也不显示任何内容。

在此处查看图像 >

c# vb.net windows visual-studio visual-studio-2015

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

Google Gmail API 定价

我在使用 client_secret.json 文件的 .Net 项目中使用 Gmail API。

那是完全免费的,还是我们需要为使用 Gmail API 支付任何费用?

还有 client_secret.json 的有效期是多久?文件有没有过期?

.net c# gmail-api

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

SSIS脚本任务找不到Newtonsoft.Json

我将 dll 安装到了 GAC 中,甚至更新了 dll 以将其安装到了 GAC 中,但出现以下错误:

“无法加载文件或程序集“Newtonsoft.Json,版本=4.5.0.0,Culture=neutral,PublicKeyToken=30ad4fe6b2a6aeed”或其依赖项之一。系统找不到指定的文件。”:“Newtonsoft.Json,版本=4.5 .0.0,文化=中立,PublicKeyToken=30ad4fe6b2a6aeed”}

应用程序配置

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
         </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>
Run Code Online (Sandbox Code Playgroud)

广汽集团地点:

C:\ Windows \ Microsoft.NET \ assembly \ GAC_MSIL \ Newtonsoft.Json \ v4.0_12.0.0.0__30ad4fe6b2a6aeed \ Newtonsoft.Json.dll

我还将 dll 复制到了 C:\Windows\System32,但是当我尝试从该位置将其添加为引用时,视觉工作室看不到它。

c# ssis gac ssis-2012

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

如何提高选项卡式页面 xamarin 表单的加载性能

我正在尝试在 Xamarin 表单中创建底部选项卡式页面,并且我正在为 Android 执行此操作。

我在这里使用最新版本的 Xamarin Forms。

我的示例底部选项卡页面如下所示。

<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            xmlns:views="clr-namespace:SampleTabbedPage.Views"
            xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
            android:TabbedPage.ToolbarPlacement="Bottom"
            android:TabbedPage.BarItemColor="Gray"
            android:TabbedPage.BarSelectedItemColor="Blue"
             mc:Ignorable="d"
             x:Class="SampleTabbedPage.Views.SampleTabbed">
  <!--Pages can be added as references or inline-->

    <NavigationPage
        Title="Main"
        NavigationPage.HasNavigationBar="False">
        <x:Arguments>
            <views:SampleDetailsPage/>
        </x:Arguments>
    </NavigationPage>

    <ContentPage Title="Tab 1" />
  <ContentPage Title="Tab 2" />
</TabbedPage>
Run Code Online (Sandbox Code Playgroud)

我的示例详细信息页面如下

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Class="SampleTabbedPage.Views.SampleDetailsPage"
             BackgroundColor="Gray">
    <ContentPage.Content>
        <StackLayout>
            <ListView BackgroundColor="White" ItemTapped="ListView_ItemTapped">
                <ListView.ItemsSource>
                    <x:Array Type="{x:Type x:String}">
                        <x:String>Mango</x:String>
                        <x:String>Banana</x:String>
                        <x:String>Pinaple</x:String>
                        <x:String>Apple</x:String>
                        <x:String>Avacado</x:String>
                        <x:String>Coconut</x:String>
                        <x:String>Dragan Fruit</x:String>
                        <x:String>Pomaganate</x:String>
                        <x:String>Wood Apple</x:String>
                    </x:Array>
                </ListView.ItemsSource>
            </ListView>

        </StackLayout>
    </ContentPage.Content>
</ContentPage> …
Run Code Online (Sandbox Code Playgroud)

c# xamarin.forms

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

VB 6内存限制

未来的客户有一个非常大的VB6程序.他们声称他们遇到了内存限制.他们无法添加更多代码行.

你知道什么是上限,是否有办法解决?

vb6

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

Linq查询与字符串值列表进行比较

我需要比较并从字符串列表中获取LINQ的匹配值.看看我的代码.

Split = Id.Split(',');
List<string> uids = new List<string>(Split);
var model = (from xx in Db.ItemWeedLogs
                where xx.ItemNo == uids   
                // I need to pass a string list to extract the matching record.
                select xx).ToList();
Run Code Online (Sandbox Code Playgroud)

c# linq

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

将项目添加到组合框,同时通过c#Windows窗体中的字符串引用组合框名称

一直在寻找高低,以获得如何做到这一点的答案!我基本上有26个组合框名为comboBox1 - comboBox26,并且想要使用for循环向每个框添加项目,所以我需要将comboBox称为字符串.解释不好,这是我到目前为止的代码;

for (int n = 1; n <= 26; n++)
{
      this.["comboBox"].Text.AddRange(new string[] 
             {"First Item", "second item", "third", "fourth", "fifth"}); 
}
Run Code Online (Sandbox Code Playgroud)

所以在循环之后,所有26个组合框都应填充该字符串数组.这和我尝试的其他所有东西都会抛出一个错误而且似乎无法找到答案,任何帮助都会很棒!

谢谢

.net c# winforms

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

使用 C#12 集合表达式初始化 List&lt;List&gt;&gt; 的语法是什么?

假设我有这样的代码(或任何类型的锯齿状结构):

var intListList = new List<List<int>> {
    new() { 1, 2, 3 }
};
Run Code Online (Sandbox Code Playgroud)

我想在这里使用集合表达式。Resharper (EAP) 建议这样做:

var intListList = new List<List<int>> {
    [1, 2, 3]
};
Run Code Online (Sandbox Code Playgroud)

但这不能编译。

这一定是可能的!语法是什么?

编辑:

好的。因此,从答案中,不是这样,而是在表达式中声明类型:

// does not compile
var intListList = new List<List<int>> {
    [1, 2, 3]
};
Run Code Online (Sandbox Code Playgroud)

类型必须显式声明,并且没有new()

// compiles!
List<List<int>> intListList = [[1, 2, 3]];
Run Code Online (Sandbox Code Playgroud)

c# collection-initializer .net-8.0 c#-12.0

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