Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27159

VS 2008 I could not solve this null exception problem:

$
0
0
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
Attached Files

Viewing all articles
Browse latest Browse all 27159

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>