小编arc*_*592的帖子

VBA中变量名后的可能后缀是什么?

正如我已经想到的那样,至少有六个:!@#$%&.

这是剪辑:

Dim A!, B@, C#, D$, E%, F&
Debug.Print "A! - " & TypeName(A)
Debug.Print "B@ - " & TypeName(B)
Debug.Print "C# - " & TypeName(C)
Debug.Print "D$ - " & TypeName(D)
Debug.Print "E% - " & TypeName(E)
Debug.Print "F& - " & TypeName(F)

输出

A! - Single
B@ - Currency
C# - Double
D$ - String
E% - Integer
F& - Long

关于这种语法糖的文档在哪里?

还有哪些其他可能的后缀?

有一个日期?

vba

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

如果在构造函数中初始化属性,则似乎不会设置XAML绑定

在构造函数中初始化属性时,我遇到了控件模板内部数据绑定的问题.

这是展示案例(您也可以下载示例解决方案):

CustomControl1.cs

public class CustomControl1 : ContentControl
{
    static CustomControl1()
    {
        DefaultStyleKeyProperty.OverrideMetadata(
            typeof(CustomControl1), 
            new FrameworkPropertyMetadata(typeof(CustomControl1)));
    }

    public CustomControl1()
    {
        Content = "Initial"; // comment this line out and everything 
                             // will start working just great
    }
}
Run Code Online (Sandbox Code Playgroud)

CustomControl1风格:

<Style TargetType="{x:Type local:CustomControl1}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type local:CustomControl1}">
                <Border Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}">
                    <ContentPresenter />
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)

CustomControl2.cs:

public class CustomControl2 : ContentControl
{
    static CustomControl2()
    {
        DefaultStyleKeyProperty.OverrideMetadata(
            typeof(CustomControl2), 
            new FrameworkPropertyMetadata(typeof(CustomControl2)));
    }
} …
Run Code Online (Sandbox Code Playgroud)

c# data-binding wpf xaml custom-controls

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

缺少DbProviderFactories.GetFactory方法(DbConnection)

根据MSDN,在.NET 4中有一个GetFactory(DbConnection)的重载.但是,我无法调用它 - 在编译时失败说:

error BC30518: Overload resolution failed because no accessible 'GetFactory' can be called with these arguments:
    'Public Shared Function GetFactory(providerRow As System.Data.DataRow) As System.Data.Common.DbProviderFactory': Value of type 'System.Data.Common.DbConnection' cannot be converted to 'System.Data.DataRow'.
    'Public Shared Function GetFactory(providerInvariantName As String) As System.Data.Common.DbProviderFactory': Value of type 'System.Data.Common.DbConnection' cannot be converted to 'String'.
Run Code Online (Sandbox Code Playgroud)

我的.NET FW有问题还是文档中的拼写错误?

ado.net

5
推荐指数
1
解决办法
728
查看次数

标签 统计

ado.net ×1

c# ×1

custom-controls ×1

data-binding ×1

vba ×1

wpf ×1

xaml ×1