Skip to content

Instantly share code, notes, and snippets.

@wolf99
wolf99 / GetSerialPortNames.vb
Last active September 2, 2015 17:14
Get a collection serial port names using VB.NET
Private Function GetSerialPortNames() As List(Of String)
Dim PortNames As New List(Of String)
For Each PortName In My.Computer.Ports.SerialPortNames
PortNames.Add(PortName)
Next
Return PortNames
End Function
@wolf99
wolf99 / ChangeFormControlEnabledState.vb
Last active August 29, 2015 14:19
Change the enabled state of all VB.NET form controls of type T
Private Sub ChangeFormControlEnabledState(Of T As Control)(f As Form, state As Boolean)
Dim c As Control
For Each c In f.Controls
If TypeOf c Is T Then
CType(c, T).Enabled = state
End If
Next
End Sub