Is there such a code when activated will create a new window and display a text file? Like e.g. (You open the debug), there is a button. If you click the button, a new window pops up and displays a certain text file on the hard drive.
P.S. I am using visual basic 2008 express edition
Please help~
Thank you,

Do you want to open up notepad externally or still in
To open up notepad externally you just

Dim p As Process = Process.Start("NotePad.exe")

Or for a file

Dim p As System.Diagnostics.Process = Process.Start("c:\test.xls")

If you dont want to open it externally, go to project, add form.. and when you click a button on form1 enter in the code

then the form 2, make the code

Public Class Form2
    Private Declare Auto Function SetParent Lib "user32" (ByVal hwndChild As IntPtr, ByVal hwndParent As IntPtr) As IntPtr

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim p As Process = Process.Start("NotePad.exe")
        SetParent(p.MainWindowHandle, Panel1.Handle)
    End Sub
End Class

Hope that helps

Is there such a code...

Of course.:)

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim txt As New TextBox With {.Multiline = True, .ScrollBars = ScrollBars.Vertical, .Dock = DockStyle.Fill}
        Dim newForm As New Form
        Dim myFile As String = "C:\!\temp.txt" '// change this to your file's location.
        Dim r As New IO.StreamReader(myFile)
        txt.Text = r.ReadToEnd
        r.Close() : r.Dispose()
        newForm.Text = IO.Path.GetFileName(myFile)
    End Sub
This article has been dead for over six months. Start a new discussion instead.