CalviN13
Gebruiker
- Lid geworden
- 22 nov 2009
- Berichten
- 41
Hoi allemaal,
Ik heb een Notepad gemaakt maar als ik op een file klik (.txt)
dan opent notepad wel maar text kom niet maar als ik het via
notepad zelf open (openfiledialog) doet hij het wel
kan iemand me de code geven omdat te fixe
P.S Als iemand de code heeft a.u.b kopier mij code
en plak hem op de goede plaats ik heb geen idee
waar die zou moeten(bedankt!!)
NotePad Code:
Alvast Erg Bedankt!
Ik heb een Notepad gemaakt maar als ik op een file klik (.txt)
dan opent notepad wel maar text kom niet maar als ik het via
notepad zelf open (openfiledialog) doet hij het wel
kan iemand me de code geven omdat te fixe
P.S Als iemand de code heeft a.u.b kopier mij code
en plak hem op de goede plaats ik heb geen idee
waar die zou moeten(bedankt!!)
NotePad Code:
Code:
Public Class Form1
Dim I As Integer = 1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Edit As New RichTextBox
TabControl1.TabPages.Add(1, "Document " & i)
TabControl1.SelectTab(i - 1)
Edit.Name = "TE"
Edit.Dock = DockStyle.Fill
TabControl1.SelectedTab.Controls.Add(Edit)
i = i + 1
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Edit As New RichTextBox
TabControl1.TabPages.Add(1, "Document " & i)
TabControl1.SelectTab(i - 1)
Edit.Name = "TE"
Edit.Dock = DockStyle.Fill
TabControl1.SelectedTab.Controls.Add(Edit)
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If TabControl1.TabCount = 1 Then
Else
TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)
TabControl1.SelectTab(TabControl1.TabPages.Count - 1)
i = i - 1
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim OpenFileDialog1 As New OpenFileDialog
Dim AllText As String = "", LineOfText As String = ""
OpenFileDialog1.Filter = "All Files|*.*"
OpenFileDialog1.ShowDialog()
Try
FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input)
Do Until EOF(1)
LineOfText = LineInput(1)
AllText = AllText & LineOfText & vbCrLf
Loop
CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).Text = AllText
Catch
Finally
FileClose(1)
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim SaveFileDialog1 As New SaveFileDialog
SaveFileDialog1.Filter = "Rich Text Files|*.rtf|Text Documents|*.txt|HTML Files|*.html|Batch Files|*.bat"
SaveFileDialog1.ShowDialog()
FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output)
PrintLine(1, CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).Text)
FileClose(1)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim FS As New FontDialog
FS.ShowDialog()
CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).Font = FS.Font
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim FC As New ColorDialog
FC.ShowDialog()
CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).ForeColor = FC.Color
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Dim AB As New PrintDialog
Try
AB.ShowDialog()
TabControl1.Text = AB.PrintToFile
Catch ex As Exception
End Try
End Sub
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
End
End Sub
End Class
Alvast Erg Bedankt!
Laatst bewerkt: