How to show lots of text on a form

  • Thread starter Thread starter **Developer**
  • Start date Start date
D

**Developer**

I want a form to display help information.

For example:

-snip--
Ctrl+Number Pad 5 Select all

Ctrl+A Select all

Ctrl+E Center alignment

Ctrl+J Justify alignment

Ctrl+R Right alignment

Ctrl+L Left alignment

Ctrl+C Copy

Ctrl+V Paste

Ctrl+X Cut

Ctrl+Z Undo

-snip--

How can I enter the data into my program?

Seems I remember that the first Basic compiler had a Data statement - I need
something like that.

I know I can use the SelecedText property one line at a time, but I'd like
to be able to use notepad on the data displayed as it will be at run time.

Of course I could include the data in a file but I don't want an extra file
at run time.

Is there a way?



Thanks
 
You could include the data in a file but set the file's Build Action
property to Embedded Resource. That way you wouldn't have the file
hanging around.

Just a thought.
 
**Developer** said:
I want a form to display help information.

For example:

-snip--
Ctrl+Number Pad 5 Select all

Ctrl+A Select all

Ctrl+E Center alignment

Ctrl+J Justify alignment

Ctrl+R Right alignment

Ctrl+L Left alignment

Ctrl+C Copy

Ctrl+V Paste

Ctrl+X Cut

Ctrl+Z Undo

-snip--

How can I enter the data into my program?

Seems I remember that the first Basic compiler had a Data statement - I
need something like that.

I know I can use the SelecedText property one line at a time, but I'd like
to be able to use notepad on the data displayed as it will be at run time.

Of course I could include the data in a file but I don't want an extra
file at run time.


Visual Basic and Visual C# Concepts -- Creating and Retrieving Resources
<URL:http://msdn.microsoft.com/library/en-us/vbcon/html/vboriUsingResources.asp>
 
I did find "Build Action" in help and it looks like a good way to go - once
I study it more.

Thanks
 
There is much new stuff here (new to me anyway) like streams and assembly.
I'll continue to read about them but this is what I tried, but s has the
value Nothing.


Thanks

Private Sub FormHelp_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

' Replace "filename" below with the actual file name for the JPG

' file you added as a resource; the name is case-sensitive.

' Also make sure that "WindowsApplication1" is replaced with the

' name of your project, if different.

'Dim s As Stream = Me.GetType().Assembly.GetManifestResourceStream("CAG
ControlEditor.EmbeddedResourceShortcutKeys.txt")

Dim _assembly As [Assembly]

_assembly = [Assembly].GetExecutingAssembly()

Dim s As Stream = _assembly.GetManifestResourceStream("CAG
ControlEditor.EmbeddedResourceShortcutKeys.txt")

Dim sr As New StreamReader(s)

Dim str As String

'Dim g As Graphics = CreateGraphics()

Do Until sr.Peek = -1

WriteLine(sr.ReadLine)

Loop

s.Close()

'g.Dispose()

End Sub
 
Think I've got it.

Thanks


Private Sub FormHelp_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim _assembly As Reflection.Assembly

_assembly = Reflection.Assembly.GetExecutingAssembly()

Dim s As Stream =
_assembly.GetManifestResourceStream("CAG.ControlEditor.EmbeddedResourceShortcutKeys.txt")

Dim sr As New StreamReader(s)

Dim str As String

Do Until sr.Peek = -1

TextBoxHelp.SelectedText = sr.ReadLine & vbCrLf

Loop

s.Close()

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top