Ik heb een simpel programma gemaakt en nu zit ik met een probleem dat deze het niet doet.
Het is namelijk zo als ik een bestand open en dat wil printen dan geeft hij een foutmelding maar die foutmelding kan ik niet thuisbrengen hij zegt zoiets dat hij het niet kan vinden.
system.IO.filenotfoundExceptio is de melding die hij geeft
Ik hoop dat dit wel goed is whoami
Het is namelijk zo als ik een bestand open en dat wil printen dan geeft hij een foutmelding maar die foutmelding kan ik niet thuisbrengen hij zegt zoiets dat hij het niet kan vinden.
system.IO.filenotfoundExceptio is de melding die hij geeft
Visual Basic .NET:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
| Imports System.Drawing.Printing Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub Private components As System.ComponentModel.IContainer Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents PrintDocument1 As System.Drawing.Printing.PrintDocument Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.Label1 = New System.Windows.Forms.Label Me.TextBox1 = New System.Windows.Forms.TextBox Me.Button1 = New System.Windows.Forms.Button Me.PrintDocument1 = New System.Drawing.Printing.PrintDocument Me.PictureBox1 = New System.Windows.Forms.PictureBox Me.Button2 = New System.Windows.Forms.Button Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog Me.SuspendLayout() ' 'Label1 ' Me.Label1.Location = New System.Drawing.Point(8, 8) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(280, 23) Me.Label1.TabIndex = 0 Me.Label1.Text = "Type the name of a graphic file to print" ' 'TextBox1 ' Me.TextBox1.Location = New System.Drawing.Point(8, 40) Me.TextBox1.Name = "TextBox1" Me.TextBox1.Size = New System.Drawing.Size(280, 22) Me.TextBox1.TabIndex = 1 Me.TextBox1.Text = "c:\vbnetsbs\chap16\sun.ico" ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(168, 232) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(112, 23) Me.Button1.TabIndex = 2 Me.Button1.Text = "Print Graphics" ' 'PictureBox1 ' Me.PictureBox1.Location = New System.Drawing.Point(48, 88) Me.PictureBox1.Name = "PictureBox1" Me.PictureBox1.Size = New System.Drawing.Size(112, 104) Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage Me.PictureBox1.TabIndex = 3 Me.PictureBox1.TabStop = False ' 'Button2 ' Me.Button2.Location = New System.Drawing.Point(16, 232) Me.Button2.Name = "Button2" Me.Button2.TabIndex = 4 Me.Button2.Text = "Open" ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15) Me.ClientSize = New System.Drawing.Size(292, 268) Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.PictureBox1) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.TextBox1) Me.Controls.Add(Me.Label1) Me.Name = "Form1" Me.Text = "Print Graphics" Me.ResumeLayout(False) End Sub #End Region Private Sub PrintGraphic(ByVal sender As Object, ByVal ev As PrintPageEventArgs) ev.Graphics.DrawImage(Image.FromFile("textbox1.text"), ev.Graphics.VisibleClipBounds) ev.HasMorePages = False End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim PrintGraphic As Object Try AddHandler PrintDocument1.PrintPage, AddressOf Me.PrintGraphic PrintDocument1.Print() Catch ex As Exception MessageBox.Show("Sorry--there is a problem printing", ex.ToString()) End Try End Sub Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click OpenFileDialog1.Filter = "Text files (*.ico|*.ico" OpenFileDialog1.ShowDialog() TextBox1.Text = OpenFileDialog1.FileName PictureBox1.Image = System.Drawing.Bitmap.FromFile(OpenFileDialog1.FileName) End Sub End Class |
Ik hoop dat dit wel goed is whoami
edit:
Het bestand bestaat wel en is goed geschreven
Het bestand bestaat wel en is goed geschreven
[ Voor 5% gewijzigd door jvaneijk op 19-01-2004 11:24 . Reden: Was wat vergeten ]