Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

File Open

Posted on March 11, 2013October 26, 2015 By David Kittell
OpenFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal)
'OpenFileDialog1.InitialDirectory = "C:Program Files"

OpenFileDialog1.Filter = "Text Files (*.txt)|*.txt|All Files(*.*)|*.*"

OpenFileDialog1.FileName = ""

OpenFileDialog1.FilterIndex = 1

'Check to see if the user clicked the open button
If (OpenFileDialog1.ShowDialog() = DialogResult.OK) Then
TextBox1.Text = OpenFileDialog1.FileName

Try
Using sr As New StreamReader(TextBox1.Text)
Dim line As String
line = sr.ReadToEnd()
TextBox2.Text = line
End Using
Catch ex As Exception
MessageBox.Show("The file could not be read:" & Environment.NewLine & ex.Message.ToString())
End Try

Else
'MsgBox("You did not select a file!")
End If
Originally Posted on March 11, 2013
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code VB.NET

Post navigation

Previous post
Next post

Related Posts

Clear Most Recently Used – Remote Desktop

Posted on July 18, 2013October 26, 2015

‘ Script: ClearRDMRU.vbs ‘Purpose: Clears the Most Recently Used list of computers in the Remote ‘Desktop Client Computer drop down box ‘ Author: Brian Heil ‘ Date: 15 March 2004 ‘Version: V1.2 ‘History: ‘ V1.0 – first script. used WMI to delete registry entries. ‘ V1.1 – added deletion of…

Read More

Uninstall Application

Posted on September 5, 2014October 26, 2015

First step is to get the application information Get-WmiObject -Query "SELECT * FROM Win32_Product WHERE Name like ‘%Outlook%’" Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -match "Outlook" } Either option will display information similar to this IdentifyingNumber : {90140000-001A-0409-0000-0000000FF1CE} Name : Microsoft Office Outlook MUI (English) 2010 Vendor : Microsoft…

Read More

Get Primary Key Column Name

Posted on July 31, 2014October 26, 2015

SELECT column_name FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE OBJECTPROPERTY(OBJECT_ID(constraint_name), ‘IsPrimaryKey’) = 1 AND table_name = ‘TableName’ Originally Posted on July 31, 2014Last Updated on October 26, 2015 All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes