T
Tomas Andersson
So here is my problem
I have a program written in VB9 that I wanted to add a file reference to textfile renamed .spf.
In the file there is stuff on every row that the program does something about.
This is the info in the registry
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.spf]
@="Strukturprogram.Document"
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\strukturprogram.File.spf]
@="Structureprogram Import File"
[HKEY_CLASSES_ROOT\strukturprogram.File.spf\DefaultIcon]
@="C:\\Program\\Heatex AB\\Strukturprogram\\Strukturprogram.exe,1"
[HKEY_CLASSES_ROOT\strukturprogram.File.spf\Open]
[HKEY_CLASSES_ROOT\strukturprogram.File.spf\Open\command]
@="C:\\Program\\Heatex AB\\Strukturprogram\\Strukturprogram.exe%1"
And here is the code that doesent seem to work.
dblklicking a textfile.spf works fine and it opens the program.
the first msgbox shows a complete path to the file
but then I get an error saying that the path is not valid (Pasted the error on the bottom of this post)
inputName3 = Command()
MsgBox(inputName3)
Dim txt As String = My.Computer.FileSystem.ReadAllText(inputName3)
MsgBox(txt)
System.ArgumentException: Ogiltiga tecken i sökvägen.
vid System.IO.Path.CheckInvalidPathChars(String path)
vid System.IO.Path.GetFileName(String path)
vid System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
vid System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
vid System.IO.StreamReader..ctor(String path, Encoding encoding)
vid System.IO.File.ReadAllText(String path, Encoding encoding)
vid Microsoft.VisualBasic.MyServices.FileSystemProxy.ReadAllText(String file)
vid Strukturprogram.Form1.Form_Load()
vid Strukturprogram.Form1._Lambda$__1(Object a0, EventArgs a1)
vid System.EventHandler.Invoke(Object sender, EventArgs e)
vid System.Windows.Forms.Form.OnLoad(EventArgs e)
vid System.Windows.Forms.Form.OnCreateControl()
vid System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
vid System.Windows.Forms.Control.CreateControl()
vid System.Windows.Forms.Control.WmShowWindow(Message& m)
vid System.Windows.Forms.Control.WndProc(Message& m)
vid System.Windows.Forms.ScrollableControl.WndProc(Message& m)
vid System.Windows.Forms.ContainerControl.WndProc(Message& m)
vid System.Windows.Forms.Form.WmShowWindow(Message& m)
vid System.Windows.Forms.Form.WndProc(Message& m)
vid System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
vid System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
vid System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Inlästa sammansättningar **************
mscorlib
Sammansättningsversion: 2.0.0.0
Win32-version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Strukturprogram
Sammansättningsversion: 1.1.0.22
Win32-version: 1.1.0.0
CodeBase: file:///C:/Program/Heatex%20AB/Strukturprogram/Strukturprogram.exe
----------------------------------------
Microsoft.VisualBasic
Sammansättningsversion: 8.0.0.0
Win32-version: 8.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
Sammansättningsversion: 2.0.0.0
Win32-version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
Sammansättningsversion: 2.0.0.0
Win32-version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Sammansättningsversion: 2.0.0.0
Win32-version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
Sammansättningsversion: 2.0.0.0
Win32-version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Sammansättningsversion: 2.0.0.0
Win32-version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
I have a program written in VB9 that I wanted to add a file reference to textfile renamed .spf.
In the file there is stuff on every row that the program does something about.
This is the info in the registry
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.spf]
@="Strukturprogram.Document"
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\strukturprogram.File.spf]
@="Structureprogram Import File"
[HKEY_CLASSES_ROOT\strukturprogram.File.spf\DefaultIcon]
@="C:\\Program\\Heatex AB\\Strukturprogram\\Strukturprogram.exe,1"
[HKEY_CLASSES_ROOT\strukturprogram.File.spf\Open]
[HKEY_CLASSES_ROOT\strukturprogram.File.spf\Open\command]
@="C:\\Program\\Heatex AB\\Strukturprogram\\Strukturprogram.exe%1"
And here is the code that doesent seem to work.
dblklicking a textfile.spf works fine and it opens the program.
the first msgbox shows a complete path to the file
but then I get an error saying that the path is not valid (Pasted the error on the bottom of this post)
inputName3 = Command()
MsgBox(inputName3)
Dim txt As String = My.Computer.FileSystem.ReadAllText(inputName3)
MsgBox(txt)
System.ArgumentException: Ogiltiga tecken i sökvägen.
vid System.IO.Path.CheckInvalidPathChars(String path)
vid System.IO.Path.GetFileName(String path)
vid System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
vid System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
vid System.IO.StreamReader..ctor(String path, Encoding encoding)
vid System.IO.File.ReadAllText(String path, Encoding encoding)
vid Microsoft.VisualBasic.MyServices.FileSystemProxy.ReadAllText(String file)
vid Strukturprogram.Form1.Form_Load()
vid Strukturprogram.Form1._Lambda$__1(Object a0, EventArgs a1)
vid System.EventHandler.Invoke(Object sender, EventArgs e)
vid System.Windows.Forms.Form.OnLoad(EventArgs e)
vid System.Windows.Forms.Form.OnCreateControl()
vid System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
vid System.Windows.Forms.Control.CreateControl()
vid System.Windows.Forms.Control.WmShowWindow(Message& m)
vid System.Windows.Forms.Control.WndProc(Message& m)
vid System.Windows.Forms.ScrollableControl.WndProc(Message& m)
vid System.Windows.Forms.ContainerControl.WndProc(Message& m)
vid System.Windows.Forms.Form.WmShowWindow(Message& m)
vid System.Windows.Forms.Form.WndProc(Message& m)
vid System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
vid System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
vid System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Inlästa sammansättningar **************
mscorlib
Sammansättningsversion: 2.0.0.0
Win32-version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Strukturprogram
Sammansättningsversion: 1.1.0.22
Win32-version: 1.1.0.0
CodeBase: file:///C:/Program/Heatex%20AB/Strukturprogram/Strukturprogram.exe
----------------------------------------
Microsoft.VisualBasic
Sammansättningsversion: 8.0.0.0
Win32-version: 8.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
Sammansättningsversion: 2.0.0.0
Win32-version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
Sammansättningsversion: 2.0.0.0
Win32-version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Sammansättningsversion: 2.0.0.0
Win32-version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
Sammansättningsversion: 2.0.0.0
Win32-version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Sammansättningsversion: 2.0.0.0
Win32-version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll