What I'm trying to do is put the file name and path up in the title of the form when I click on "New", "Append", "Inquiry", and "Lookup." All I get is "OpenFileDialog1" or a blank that removes the date and time and other text. I've included the code and a print screen of the form below.
Image may be NSFW.
Clik here to view.
Code:
Option Strict On
Imports System.IO
Public Class frmTitle
Dim outPutFile As StreamWriter
Dim inPutFile As StreamReader
Dim OutOpen, InOpen As Boolean
Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click
Dim fpath As String = ofdOpenFile.FileName
Dim fbd As New FolderBrowserDialog
Dim mainPath As String
If fbd.ShowDialog = DialogResult.OK Then
mainPath = fbd.SelectedPath
End If
sfdSaveFile.Filter = "Inventory files (*.emp)|*.txt|All files (*.*)|*.*"
If sfdSaveFile.ShowDialog = Windows.Forms.DialogResult.OK Then
outPutFile = File.CreateText(sfdSaveFile.FileName)
End If
grpEmpData.Enabled = True
btnSave.Enabled = True
btnNext.Enabled = False
btnFind.Enabled = False
If NewToolStripMenuItem.Enabled = True Then
NewToolStripMenuItem.Enabled = False
AppendToolStripMenuItem.Enabled = False
InquiryToolStripMenuItem.Enabled = False
LookUpToolStripMenuItem.Enabled = False
CloseToolStripMenuItem.Enabled = True
'ofdOpenFile.ShowDialog = Windows.Forms.DialogResult.OK
'Me.Text = mainPath
Me.Text = ofdOpenFile.FileName
End If
Clik here to view.
