Code Snippets

  

VB.NET Source Code


Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 117,284 VB.NET Programmers for FREE! Ask your question and get quick answers from experts. There are 2,367 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!




Get a list of the currently registered file extensions

Not just the name, but the description as well

Submitted By: jacobjordan
Actions:
Rating:
Views: 267

Language: VB.NET

Last Modified: July 1, 2008
Instructions: Use the GetExtention() function to load the list.

Snippet


  1. Function GetExtensions() As System.Collections.ObjectModel.Collection(Of Extension)
  2.         Dim r As New System.Collections.ObjectModel.Collection(Of Extension)()
  3.         For Each item As String In My.Computer.Registry.ClassesRoot.GetSubKeyNames()
  4.             If item.Substring(0, 1) = "." Then
  5.                 Dim d As New Extension
  6.                 d.Name = item
  7.                 Try
  8.                     d.Description = My.Computer.Registry.ClassesRoot.OpenSubKey _
  9.                     (My.Computer.Registry.ClassesRoot.OpenSubKey(item).GetValue("")).GetValue("")
  10.                 Catch
  11.                 End Try
  12.                 If d.Description = Nothing Then d.Description = "None"
  13.                 r.Add(d)
  14.             End If
  15.         Next
  16.         Return r
  17.     End Function
  18.  
  19.     Structure Extension
  20.         Dim Name As String
  21.         Dim Description As String
  22.     End Structure

Copy & Paste


Comments


There are currently no comments for this snippet. Be the first to comment!

Add comment


You must be registered and logged on to </dream.in.code> to leave comments.





Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month