This is NOT a how do I code it question.
I am sure we all have ways of saving various code snippets.
I decided to develop a application that stores links to a folder on my C drive.
In my case I use Sublime Text to create the copied code file.
One issue I have noticed is that NOT adding an extension to the file name will result in
the user needing to select the program to open the file.
If I add .txt then the default program in my case is Sublime Text.
So first question is add the extension to the file or not?
The fields I have considered adding to the DB are as follows.
Code Description Code Type Link URL and Used in Project
At this time I see no point in adding a DATE field as that info is already on the file.
Second questions is there other information you would consider valuable to include?
The process to view this data would be to place the fields in a DataGridView
where the user could select the row to open the file for viewing.
Code Type would not be displayed in the DGV. (See Below)
From the Start Form the user could select to Edit, Delete or View the data.
The Code Type field would be in a Combo Box that would have types added and if the type
did not have a corresponding SubFolder one would be created under the main folder.
Third question is this over complication that adds no great functionality?
This brings me back to using Code Type in the DB so when viewing the user could
have the option to only view various code types by selecting the code type from the ComboBox.
Your thoughts on this are more than welcomed and appreciated.
Last question is there a better way to get the code from VS 2019 into Sublime Text?
I have considered using OpenFileDialog like this and going directly into the source repos. I am not sure I want to do that if I break it not sure I can fix it!
Here is my tentative code
Private Sub btnCopyFile_Click(sender As Object, e As EventArgs) Handles btnCopyFile.Click
'Create Directory
'Dim fullPath = "C:\A A Code Vault\VB.Net\"
'Directory.CreateDirectory(fullPath)
'===========================================
'Be sure to place a OpenFileDialog Control on the Form
'I suggest naming it OpenFileDialog NOT OpenFileDialog1
'You will need to add Imports System.IO
'========================================================
Dim openFileDialog As OpenFileDialog = New OpenFileDialog()
Dim dr As DialogResult = openFileDialog.ShowDialog()
If dr = System.Windows.Forms.DialogResult.OK Then
Dim pathSource As String = openFileDialog.FileName
Dim fileName As String = System.IO.Path.GetFileName(openFileDialog.FileName)
MsgBox("Path " & pathSource & " " & fileName)
Dim sSource As String = pathSource
Dim sTarget As String = "C:\A A Code Vault\VB.Net\" & fileName
Dim folder As String = "C:\A A Code Vault\VB.Net\"
If Not System.IO.Directory.Exists(folder) Then
System.IO.Directory.CreateDirectory(folder)
End If
File.Copy(sSource, sTarget, True)
End If
End Sub
What I have tried:
I have tested the code but not on the source repo folder. Chicken