0

would like to confirm something as i am using windows 10 and TaskDialog seems to not show any available TaskDialogStandardIcon. Can somebody confirm whether same behaviour at windows 7 for instance? If so how to fix that on WIndows 10?

Example code:

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
    Dim dialog As New TaskDialog()
    dialog.Caption = "Application Error"
    dialog.InstructionText = "CRASH AND BURN!"
    dialog.Text = "The application has performed an illegal action.  Thisaction has been logged and reported."
    dialog.Icon = TaskDialogStandardIcon.Error
    dialog.Cancelable = False
    dialog.DetailsExpanded = False
    dialog.DetailsCollapsedLabel = "Show Expanded Text"
    dialog.DetailsExpandedLabel = "Hide Expanded Text"
    dialog.DetailsExpandedText = "### Start of Expanded Text ###" & Environment.NewLine & "" + Environment.NewLine + "### End of Expanded Text ###"
    Dim minValue As Integer = 0
    Dim maxValue As Integer = 100
    Dim currentValue As Integer = 20
    dialog.ProgressBar = New TaskDialogProgressBar(minValue, maxValue, currentValue)
    dialog.Show()
End Sub

i found this topic: Windows API Code Pack TaskDialog missing icon

Do you know whether this could solve my problem and how to do it in vb.net?

Community
  • 1
  • 1
Arie
  • 3,041
  • 7
  • 32
  • 63

1 Answers1

0

Sorry for topic i found solution:

to every TaskDialog we have to make event handler of the Opened as follows:

 Public Sub taskDialog_Opened(sender As Object, e As EventArgs)
        Dim taskDialog As TaskDialog = TryCast(sender, TaskDialog)
        taskDialog.Icon = taskDialog.Icon
        taskDialog.FooterIcon = taskDialog.FooterIcon
        taskDialog.InstructionText = taskDialog.InstructionText
    End Sub

then it will go as follows:

 Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
        Dim mydialog As New TaskDialog
        mydialog.Caption = "Application Error"
        mydialog.InstructionText = "CRASH AND BURN!"
        mydialog.Text = "The application has performed an illegal action.  Thisaction has been logged and reported."
        mydialog.Icon = TaskDialogStandardIcon.Error


        AddHandler mydialog.Opened, AddressOf taskDialog_Opened '<========


        mydialog.Show()


    End Sub
Arie
  • 3,041
  • 7
  • 32
  • 63