Hi, after 3 years being far from programming, i needed to write something to joining my scanned papers (jpeg) but i couldnt find an exact solution how to solve the problem below:
Please help me to solve, thanks in advance.
Dim resimdegiskensayaci As String = 1
Dim exhawidth, exhaheight As Integer
exhawidth = (8.3) * (Convert.ToInt32(dpibilgisi.Text))
exhaheight = (11.7) * (Convert.ToInt32(dpibilgisi.Text)) * (ListBox1.Items.Count)
Dim i As Integer = 1
Dim resimdegiskenarray() As System.Drawing.Image
For Each item In ListBox1.Items
resimdegiskenarray(i) = System.Drawing.Image.FromFile(item.ToString) 'null reference error causing line (warning: variable 'resimdegiskenarray is used before it has been assigned a value. A null reference exception could resut at runtime. :sick: :sick: :sick:
Next
Dim sonuc As New System.Drawing.Bitmap(exhawidth, exhaheight)
Dim grafik As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(sonuc)
i = 0
For Each item In ListBox1.Items
resimdegiskenarray(i).dispose()
i = i + 1
Next
sonuc.Save(TextBox3.Text, System.Drawing.Imaging.ImageFormat.Jpeg)
Full code:Attachment 95671
Please help me to solve, thanks in advance.
Dim resimdegiskensayaci As String = 1
Dim exhawidth, exhaheight As Integer
exhawidth = (8.3) * (Convert.ToInt32(dpibilgisi.Text))
exhaheight = (11.7) * (Convert.ToInt32(dpibilgisi.Text)) * (ListBox1.Items.Count)
Dim i As Integer = 1
Dim resimdegiskenarray() As System.Drawing.Image
For Each item In ListBox1.Items
resimdegiskenarray(i) = System.Drawing.Image.FromFile(item.ToString) 'null reference error causing line (warning: variable 'resimdegiskenarray is used before it has been assigned a value. A null reference exception could resut at runtime. :sick: :sick: :sick:
Next
Dim sonuc As New System.Drawing.Bitmap(exhawidth, exhaheight)
Dim grafik As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(sonuc)
i = 0
For Each item In ListBox1.Items
resimdegiskenarray(i).dispose()
i = i + 1
Next
sonuc.Save(TextBox3.Text, System.Drawing.Imaging.ImageFormat.Jpeg)
Full code:Attachment 95671