Page 1 of 1

clickable entries in RichTextBox

Posted: Thu Apr 22, 2021 1:47 pm
by boyddt_co
I am creating a site/server checking application and the end users decided that if a site/server fails they want to be able to click on it and get a tracert outputted. What are my options to have a link embedded in the RTB field? I've included a screenshot. So, in this example, they would want to click on Web Server and open a window that would run test-netconnection -tracert command.
SiteChecker.PNG
SiteChecker.PNG (9.68 KiB) Viewed 2564 times

Re: clickable entries in RichTextBox

Posted: Thu Apr 22, 2021 3:19 pm
by jvierra
I recommend using a ListView control as it has better support for links when displayed as a hierarchy.

Re: clickable entries in RichTextBox

Posted: Fri Apr 23, 2021 9:39 am
by boyddt_co
Thank you, I will give that a try.

Re: clickable entries in RichTextBox

Posted: Fri May 14, 2021 12:47 pm
by boyddt_co
So I'm trying the listview box and it isn't working as expected. Using the add-listviewitem code that is automatically added, entries are duplicated. In the picture you can see the output to the GUI and the output to the console. The code where I call the add-listviewitem is included.

Sapien_ListView.PNG
Sapien_ListView.PNG (31.08 KiB) Viewed 2117 times
  1. $SitePing = $global:SiteDict[$TestCount].SitePing
  2.         $SiteName = $global:SiteDict[$TestCount].SiteName
  3.         $SiteURL = $global:SiteDict[$TestCount].SiteURL
  4.         $SitePorts = $global:SiteDict[$TestCount].Ports -split ","
  5.         $TotalPorts = $SitePorts.Count
  6.         $Path = (Split-Path $script:MyInvocation.MyCommand.Path).replace(" ", "`` ") + "\portqry.exe"
  7.         $listview1.Items.Add($SiteName + "`r`n")
  8.         Write-Host $SiteName
  9.         Add-ListViewItem -ListView $listview1 -Items $SiteName

Re: clickable entries in RichTextBox

Posted: Fri May 14, 2021 1:47 pm
by jvierra
Obviously you event is being called twice for each entry.