Re: How I can read textfile contained in the exe

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hello Jan

"JR" <jan.schaak@xxxxxxxxx> wrote in message news:87817626-4c5f-485d-a745-c3efb67e5a02@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On 10 nov, 14:54, "Samir Ibrahim" <samir.ibra...@xxxxxxxxxxx> wrote:
Hi Jan,
That works very well. Thank you.

Hi Mike
That was just perfect, although I did not understand a thing. lol

Another question regarding this.
- I have a 1 textfile, 1 Excel, 2 Access 2007 Database which I want to
include in my exe
- I manage to read the textfile using resources and System.Reflection
- I manage to extract excel file from resources to my hdd by this linkhttp://social.msdn.microsoft.com/Forums/en/Vsexpressvb/thread/d481095...
- I guess I can do the same for the first access 2007 and extract it to a
folder.

But can I use the second access 2007 which I want to read rows from it using
either resources or System.Reflection without extracting it?

Thanks.

"Family Tree Mike" <FamilyTreeM...@xxxxxxxxxxxxxxxx> wrote in messagenews:eALSN5fYKHA.4148@xxxxxxxxxxxxxxxxxxxxxxx



> Samir Ibrahim wrote:
>> Hi All

>> I don't know if my question is right, but that is how I understand it.

>> In the vb2008 project if I add a text file let say (c:\abc.txt) to my
>> project,
>> this file will be copied to the project folder, then if I click on the
>> abc.txt from
>> my project a property window will displayed, one of the property there >> is
>> "build action", which may have one of the following
>> None,Compile,Content,Embedded
>> Resource,ApplicationDefinition,Page,Resource,SplashScreen,EntityDeploy

>> What should I choose in order to let this txt file included in the exe
>> and how I can later read it.

>> Thanks in advance

> Set the property to 'Embedded Resource'. You can then read it as > follows:

> Sub Main()
> Dim s As Stream
> Dim executing_assembly As System.Reflection.Assembly _
> = Assembly.GetEntryAssembly()
> Dim my_namespace As String _
> = executing_assembly.GetName().Name.ToString()
> s = executing_assembly.GetManifestResourceStream _
> my_namespace + ".abc.txt")

> Dim sr As New System.IO.StreamReader(s)
> Dim msg As String = sr.ReadToEnd
> Console.WriteLine(msg)
> Console.ReadKey()
> End Sub

> --
> Mike- Tekst uit oorspronkelijk bericht niet weergeven -

- Tekst uit oorspronkelijk bericht weergeven -
Hi,

I'm always a little vague with the awnser. So you also have to look a
bit :)

Little vague is much easier than reading Chinese As Mike response lol

Conserning your Access files However you will have to create 2 access
aplications fort the 2 files, I think it will be easier to open them
with ado.

That is the idea, one Access file should handle information belong to the excel file and I just want to read it from the EXE using ADO , Can I ? (just to add, not very important demand)
The other file will be extracted and the excel file should read it using odbc,

something to think about:
I don't think you will be able to lood them again into your exe file.
You already have 4 files as a resource. Maybe the exe will be very
large.

Jan

You are absolutely correct, but this exe work as a management only, the user will click on (new project from the menu), this should create new (extract) Excel file, New Access File, create dsn, and link the Excel to get query from the Access and when that finished, the user will work on the Excel all the time.

Thank you for your advice.

Samir Ibrahim

.



Relevant Pages

  • Re: How I can read textfile contained in the exe
    ... I manage to read the textfile using resources and System.Reflection ... I guess I can do the same for the first access 2007 and extract it to a folder. ... What should I choose in order to let this txt file included in the exe and how I can later read it. ... Dim s As Stream ...
    (microsoft.public.dotnet.languages.vb)
  • Re: How to use binary files as resources in VB 2005
    ... I had already added the Exe file as a resource to ... my Vb 2005 project but I need to extract that to a file, ... Dim ResourceStream As IO.Stream ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Exporting query to excel
    ... The excel file is created when I click the 'Create Journal Entry' button. ... no data is entered into the spreadsheet. ... Public Function ExportQueryAs String ... Dim appExcel As Excel.Application ...
    (microsoft.public.access.externaldata)
  • Re: Is it possible...
    ... Dim dbs As DAO.Database ... Dim strSQL As String ... EXCEL file in the same order as the fields in the permanent table. ...
    (microsoft.public.access.externaldata)
  • RE: code to create five different sql queries
    ... Excel file, not five Excel files. ... Private Sub ExportToExcelBtn_Click ... Dim IR_ListAs String ...
    (microsoft.public.access.formscoding)