PowerShell -Working With DataGridView- WinForm and DataTable
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: PowerShell -Working With DataGridView- WinForm and DataTable
Sure, I missed this one. here is the url, 'https://psu.box.com/shared/static/jf36o ... w4y708.rss'
Re: PowerShell -Working With DataGridView- WinForm and DataTable
jvierra, the link goes to a server that probably is not open to the public. If you tell me what commands to run on the xml file, I can return the file structure.
Re: PowerShell -Working With DataGridView- WinForm and DataTable
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>IT Alerts</title>
<link>https://*/sp?id=service_status</link>
<description>IT Alerts for the last 7 days, plus Planned Maintenance for the next 5 days.</description>
<lastBuildDate>21 Apr 2020 11:54:56 -0400</lastBuildDate>
<language>en-us</language>
<generator>IT Alerts 1.0</generator>
<image>
<url>https://*/logosignature.png</url>
<title>IT Alerts</title>
<link>https://*/sp?id=service_status</link>
</image>
<atom:link href="https://*/shared/static/jf36ohodxnw7oemghsau1t7qb0w4y708.rss" rel="self" type="application/rss+xml" /><item>
<title>Office365 Email and Calendars Degradation</title>
<link><![CDATA[https://*/sp?id=service_status&service=7119bb164fd68b80d0f9e3414210c77a]]></link>
<pubDate>14 Apr 2020 14:46:29 -0400</pubDate>
<guid isPermaLink="false">1ef68ac41b401cd07746766dcc4bcb35</guid>
<description><![CDATA[<p><strong>IT continues to address issues as they arise. You can find workaround instructions at <a href="https://*/sp?id=kb_article_view&sysparm_article=KB0013571" rel="nofollow">https://*/sp?id=kb_article_view&sysparm_article=KB0013571</a> (KB0013571).</strong></p>
<p> </p>
<p><strong>People and Locations Impacted:</strong><br />All students, faculty, & staff at all locations with confirmation messages sent to Office 365<br /><br /><strong>IT Service(s) Impacted:</strong><br />lists.psu.edu<br /><br /><strong>Date and Time:</strong><br />Issue began on 03/31/20 and Penn State IT is working with the vendor (Microsoft) on a resolution.<br /><br /><strong>Notes:</strong><br />You can find workaround instructions at <a href="https://*/sp?id=kb_article_view&sysparm_article=KB0013571" rel="nofollow">https://*/sp?id=kb_article_view&sysparm_article=KB0013571</a> (KB0013571).<br /><br /><strong>Technical Information:</strong><br />Office 365/Microsoft ATP is deep scanning listserv confirmation links which is causing messages to be approved without the moderator actually clicking the message to approve. This alert will be updated as new information becomes available. All IT users can view additional details in ServiceNow.<br /><br /><strong>Public Contact for this Alert:</strong><br />IT Service Desk<br />itservicedesk@*<br />888-888-HELP</p>]]></description>
</item>
</channel>
</rss>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>IT Alerts</title>
<link>https://*/sp?id=service_status</link>
<description>IT Alerts for the last 7 days, plus Planned Maintenance for the next 5 days.</description>
<lastBuildDate>21 Apr 2020 11:54:56 -0400</lastBuildDate>
<language>en-us</language>
<generator>IT Alerts 1.0</generator>
<image>
<url>https://*/logosignature.png</url>
<title>IT Alerts</title>
<link>https://*/sp?id=service_status</link>
</image>
<atom:link href="https://*/shared/static/jf36ohodxnw7oemghsau1t7qb0w4y708.rss" rel="self" type="application/rss+xml" /><item>
<title>Office365 Email and Calendars Degradation</title>
<link><![CDATA[https://*/sp?id=service_status&service=7119bb164fd68b80d0f9e3414210c77a]]></link>
<pubDate>14 Apr 2020 14:46:29 -0400</pubDate>
<guid isPermaLink="false">1ef68ac41b401cd07746766dcc4bcb35</guid>
<description><![CDATA[<p><strong>IT continues to address issues as they arise. You can find workaround instructions at <a href="https://*/sp?id=kb_article_view&sysparm_article=KB0013571" rel="nofollow">https://*/sp?id=kb_article_view&sysparm_article=KB0013571</a> (KB0013571).</strong></p>
<p> </p>
<p><strong>People and Locations Impacted:</strong><br />All students, faculty, & staff at all locations with confirmation messages sent to Office 365<br /><br /><strong>IT Service(s) Impacted:</strong><br />lists.psu.edu<br /><br /><strong>Date and Time:</strong><br />Issue began on 03/31/20 and Penn State IT is working with the vendor (Microsoft) on a resolution.<br /><br /><strong>Notes:</strong><br />You can find workaround instructions at <a href="https://*/sp?id=kb_article_view&sysparm_article=KB0013571" rel="nofollow">https://*/sp?id=kb_article_view&sysparm_article=KB0013571</a> (KB0013571).<br /><br /><strong>Technical Information:</strong><br />Office 365/Microsoft ATP is deep scanning listserv confirmation links which is causing messages to be approved without the moderator actually clicking the message to approve. This alert will be updated as new information becomes available. All IT users can view additional details in ServiceNow.<br /><br /><strong>Public Contact for this Alert:</strong><br />IT Service Desk<br />itservicedesk@*<br />888-888-HELP</p>]]></description>
</item>
</channel>
</rss>
Re: PowerShell -Working With DataGridView- WinForm and DataTable
jvierra, with so many rows presented to the end-user, what is the command to collapse a row or expand the row if the user wants to read more
Re: PowerShell -Working With DataGridView- WinForm and DataTable
instead of using datagrid, i could use convertto-html or something similar. RSS alerts could come down in five or six in any given moment. People not going to like scrolling through pages.
Re: PowerShell -Working With DataGridView- WinForm and DataTable
Hi, I made a complete adjustment to the original script. It is working and building on html code. However, I would love to have the title for each of the event on top of the description, and to use collapsible option so only shows the event title. And, if the end-user wants to read the topic or title, to have the option to click on the cell with the title and to be able to expand the road.
- cls
- function GenerateForm {
- Add-Type -AssemblyName System.Windows.Forms
- Add-Type -AssemblyName System.drawing
- #Form Setup
- $form1 = New-Object System.Windows.Forms.Form
- $TabControl = New-object System.Windows.Forms.TabControl
- $AlertsPage = New-Object System.Windows.Forms.TabPage
- $InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
- #Form Parameter
- $form1.Text = "Computer User Preferences and Utilities"
- $form1.Name = "form1"
- $form1.DataBindings.DefaultDataSourceUpdateMode = 0
- $form1.StartPosition = "CenterScreen"
- $System_Drawing_Size = New-Object System.Drawing.Size
- $System_Drawing_Size.Width = 775
- $System_Drawing_Size.Height = 490
- $form1.ClientSize = $System_Drawing_Size
- #Tab Control
- $tabControl.DataBindings.DefaultDataSourceUpdateMode = 0
- $System_Drawing_Point = New-Object System.Drawing.Point
- $System_Drawing_Point.X = 30
- $System_Drawing_Point.Y = 65
- $tabControl.Location = $System_Drawing_Point
- $tabControl.Name = "tabControl"
- $System_Drawing_Size = New-Object System.Drawing.Size
- $System_Drawing_Size.Height = 405
- $System_Drawing_Size.Width = 725
- $tabControl.Size = $System_Drawing_Size
- $form1.Controls.Add($tabControl)
- #Eventlog Page
- $AlertsPage.DataBindings.DefaultDataSourceUpdateMode = 0
- $AlertsPage.UseVisualStyleBackColor = $True
- $AlertsPage.Name = "AlertPage"
- $AlertsPage.Text = "Alerts”
- $tabControl.Controls.Add($AlertsPage)
- $head = @"
- <style>
- body { background-color:#dddddd;
- font-family:Tahoma;
- font-size:10pt; }
- td, th { border:1px solid black;
- border-collapse:collapse; }
- th { color:white;
- background-color:black; }
- table, tr, td, th { padding: 2px; margin: 0px }
- table {width:100% margin-left:0px; }
- </style>
- "@
- $webBrowser1 = new-object system.net.webclient
- $rssFeed = [xml]$webBrowser1.DownloadString('https://*/jf36ohodxnw7oemghsau1t7qb0w4y708.rss')
- $items = $rssFeed.rss.channel.item |
- ForEach-Object {
- [PSCustomObject]@{
- Date = [datetime]$_.pubDate
- Title = $_.title
- Description = [string]$_.description.innertext -replace '<br ?/?>',[System.Environment]::NewLine -replace '<[^>]+>'
- #Category = [string]$_.description.innertext -replace '<br ?/?>',[System.Environment]::NewLine -replace '<[^>]+>'
- }
- }
- $items |Sort-Object Date -Descending | ConvertTo-Html -Head $head | out-File -filepath "c:\Alerts\alert.html"
- $webBrowser1 = New-Object System.Windows.Forms.WebBrowser
- $webBrowser1.Location = New-Object System.Drawing.Size(10,60)
- $webBrowser1.Size = New-Object System.Drawing.Size(690,300)
- $webBrowser1.URL= "c:\Alerts\alert.html"
- $AlertsPage.Controls.Add($webBrowser1)
- #Save the initial state of the form
- #Init the OnLoad event to correct the initial state of the form
- #Show the Form
- $form1.ShowDialog()| Out-Null
- } #End Function
- GenerateForm