About application

madi2999

Member
Joined
Aug 8, 2004
Messages
10
Programming Experience
Beginner
Hello,

I am trying to display "about application" as a menu option under

help, I have created a text file containing the information about the application

but I am not sure how can I make the application upon clicking on

about application display the text file..


your help is greatly appreciated
 
They're r two ways to do that; 1) You can make your application run notepad and open the text file or 2) You can read the text file, load the content to a variable, and then display it somewhere in your application.

This is the second method:
VB.NET:
'At the very top add:
Imports System.IO
 
'Add this to global definitions
[size=2][color=#0000ff]Dim[/color][/size][size=2] txt [/size][size=2][color=#0000ff]As [/color][/size][size=2][color=#0000ff]String
[/color][/size]
'add this to "about application"
[size=2][color=#0000ff]Dim[/color][/size][size=2] oread [/size][size=2][color=#0000ff]As[/color][/size][size=2] StreamReader = [/size][size=2][color=#0000ff]New[/color][/size][size=2] StreamReader("C:\test.txt")[/size]
[size=2]txt = oread.ReadToEnd()[/size]
[size=2]'now txt should contain the content of the txt file so you can display it wherever u want
[/size]

I'm not entirely sure about how to do the first method, I've seen it done before, but I'm not too familiar with it. I personally prefer the second method, but let me know if you want to see and example for the first method

Gpmaker

EDIT: dim txt as string, should be on global defenitions
 
Last edited:
Or, you can to this:
put the text file in the project, and then in the properties, change it to embebed resources.
With this, you don't need, destribute the text file
------
Dim _FileName As String = "Evolution.rtf" ' my file
Dim _RAssembly As System.Reflection.Assembly = Me.GetType.Assembly.GetEntryAssembly()
Dim _namespace As String = _RAssembly.GetName().Name.ToString()
Dim _Pagina As Stream = _RAssembly.GetManifestResourceStream(_namespace + "." & _FileName)
If Not (_Pagina Is Nothing) Then
Dim _LPagina As New StreamReader(_Pagina, System.Text.Encoding.GetEncoding(1252))
Dim _Fs As FileStream = New FileStream(myFichTempor & "\" & _FileName, FileMode.Create, FileAccess.Write, FileShare.None)
Dim _FPagina As StreamWriter = New StreamWriter(_Fs, System.Text.Encoding.GetEncoding(1252))
_FPagina.Write(_LPagina.ReadToEnd())
_FPagina.Flush()
_FPagina.Close()
_Fs.Close()
'rtbEvolution is a richtextbox
rtbEvolution.LoadFile(myFichTempor & "\" & _FileName)
End If
 
Back
Top