vb.net - Error copying from resources -


while copying resources folder under appdata folder: error, i'm not finding mistake in code..

private sub help_load(sender object, e eventargs) handles mybase.load     file.writeallbytes(mainpath & "\help.rtf", my.resources.helprtf)      dim helprtf = (mainpath & "\help.rtf")     helpbox.loadfile(helprtf) end sub 

helprtf .rtf file, mainpath directory under %appdata% folder

error: value of type 'string' cannot converted 'byte()'.

error at: my.resources.helprtf

the reason why error because second parameter of file.writeallbytes() method takes byte(), not string. if want write text (string) file, can use file.writealltext() method.

since rtf's can contain images, text, etc. treating text can corrupt , needless say, encoding issues might occur. so, instead of using file.writealltext() method, change filetype of helprtf resource binary instead of text this:

screenshot

after that, can use code was:

private sub help_load(sender object, e eventargs) handles mybase.load     file.writeallbytes(mainpath & "\help.rtf", my.resources.helprtf)     dim helprtf = (swinpath & "\help.rtf")     helpbox.loadfile(helprtf) end sub 

references:


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -