I have a Windows Control Library project (visual studio 2010). I put in the compile tab for it to be a com element (I use it as an addin for another program).
My question is the following: I have a .cvs file in my resources that I use to parse some main settings. The line of code that reads this file gives an error when I run the addin. code line:
dim reader as new streamReader(My.Resources.standards)
(the file is called standards)
error I get when running the com element:
Illegal character in path.
The program runs nicely when I test it as a normal windows form project.
Anyone know how to fix this? Or how to do decent debugging when testing com elements.
Thanks.
This does not have anything to do with COM, scratch that as a cause of your problem. Clearly your
My.Resources.standards
property returns a string, not a stream. Which is pretty normal when you add a text file as a resource. It makes StreamReader try to open a file on disk using the content of the .cvs resource as the path of the file. That will of course not work well.You could use a StringReader instead. Or just use the returned string as-is.
Change it to following dim reader = new string(My.Resources.standards) you have a string now that can be used in regex Cobus