I am trying to create an association for my vb.net application.
I've got two forms, of which the startup form is called "frmMain" and the other which has a rich textbox that displays results from a file (.tbx) is called "frmResultsViewer"
What I want is that when a person wishes to open a .tbx file on his pc, it should open into "frmResultsViewer".
I am using this code at the moment, but it open into "frmMain". I have placed this code into the "frmResultsViewer" code but still open with the startup form.
Code:Public Sub CheckAssociation() My.Computer.Registry.ClassesRoot.CreateSubKey(".tbx").SetValue("", "Tiny Toolbox", Microsoft.Win32.RegistryValueKind.String) My.Computer.Registry.ClassesRoot.CreateSubKey("Tiny Toolbox\shell\open\command").SetValue("", Application.ExecutablePath & " ""%1"" ", Microsoft.Win32.RegistryValueKind.String) My.Computer.Registry.ClassesRoot.CreateSubKey("Tiny Toolbox\DefaultIcon").SetValue("", Application.StartupPath & "\TBX.ico") End Sub
FORM LOAD:
Code:CheckAssociation() Dim file As String = Command$() If Not file = "" Then file = Replace(file, Chr(34), "") Me.rtxtResult.LoadFile(file) End If




Reply With Quote