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,
Ken

Do you want to open up notepad externally or still in vb.net??
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

form2.show

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")
        p.WaitForInputIdle()
        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
        newForm.Controls.Add(txt)
        Dim myFile As String = "C:\!vb.net\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)
        newForm.Show()
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.