小编Bri*_*n S的帖子

'[Modulename]'的类型初始化程序引发了异常

我有这个新的vb.net项目(MedicalCost)有这个错误"'MedicalCost.Constants'的类型初始化程序引发了异常." 在运行sub时我已经在我之前的项目中完成了这一切,当我在我的模块上声明公共变量但现在在我当前的项目中它不起作用时一切正常.

这是我模块上的代码(常量):

 Imports System.Data.Sql
    Imports System.Data.SqlClient
    Imports System.Data.Odbc
    Imports System.Windows.Forms

    Public Module Constants
        Public ppiconn As New SqlConnection("Dsn=pandiman2002connectdsn;server=ppi;uid=sa;database=Pandimandata2002")
        'Dsn=pandiman2002connectdsn;description=PPI Database;uid=sa;app=Microsoft® Visual Studio® 2010;wsid=CRWUSER17-PC;database=Pandimandata2002
        Public da As New SqlDataAdapter
        Public comm As New SqlCommand
        Public dr As SqlDataReader
        Public ds As New DataSet

        Public x As String


    End Module
Run Code Online (Sandbox Code Playgroud)

当我在我的frm_add上运行sub时

这是我的代码

Sub search_crew()

    Try
        x = "(isnull(ltrim(rtrim(firstname)),'') + ' ' + isnull(ltrim(rtrim(mi)),'') + ' ' + " _
               & "isnull(ltrim(rtrim(lastname)),'') like '%" & Replace(searchbox.Text, " ", "%") & "%' " …
Run Code Online (Sandbox Code Playgroud)

vb.net module exception

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

将鼠标悬停效果添加到XAML中带有Image的按钮

我有一个带有Image的按钮,如下所示:

<Button Width="22" Height="22" Command="{Binding PreviousCommand}">                               
  <Button.Template>
    <ControlTemplate>
      <Image Source="C:\Users\abcdef\Desktop\Slide-To-Left-Arrow-24.png"></Image>                            
    </ControlTemplate>
  </Button.Template>
  <Button.InputBindings>
    <KeyBinding Key="Up" Command="{Binding PreviousCommand}" Modifiers="Alt+Shift" />
  </Button.InputBindings>
</Button>
Run Code Online (Sandbox Code Playgroud)

我想应用一些鼠标悬停效果来识别按钮是可点击/可聚焦的.我尝试添加触发器如下,但它无法正常工作:

<ControlTemplate.Triggers>
  <Trigger Property="IsMouseOver" Value="True"> 
    <Setter Property="Background" Value="Black" /> 
  </Trigger>
</ControlTemplate.Triggers>
Run Code Online (Sandbox Code Playgroud)

它不起作用.我需要做什么?请帮帮我.

wpf xaml styles button

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

标签 统计

button ×1

exception ×1

module ×1

styles ×1

vb.net ×1

wpf ×1

xaml ×1