TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sofia Rodrigues
NA
23
1.7k
Parameter is not valid - "pictureBox.Show()"
Mar 14 2019 5:44 AM
I'm making a TIFF viewer with a picture box and buttons for going trought the pages of multi page files.
When I open a file for the first time, all works great, then I close it. But when I open a new file, after closing the previous one, I get an error saying "Parameter is not valid" at the line "pbtiff.Show()".
This is my code for opening the file:
private
void
openToolStripMenuItem_Click(
object
sender, EventArgs e)
{
pbtiff.Hide();
OpenFileDialog dialogo =
new
OpenFileDialog();
dialogo.Title =
"Search files"
;
dialogo.InitialDirectory = @
"E:\"
;
dialogo.Filter =
"PDF Files(.pdf)|*.pdf|Image Files (.bmp,.jpg,.png,.tiff,.tif) |*.bmp;*.jpg;*.png;*tiff;*tif"
;
DialogResult answer = dialogo.ShowDialog();
if
(answer == DialogResult.OK)
{
string
fullPath = dialogo.FileName;
openFile = fullPath;
using
(var fileStream =
new
FileStream(ficheiroaberto, FileMode.Open))
{
type = Path.GetExtension(caminhoCompleto);
if
(type ==
".tif"
|| type ==
".tiff"
)
{
up.Visible =
true
;
up.Enabled =
false
;
down.Visible =
true
;
pbtiff.Show(); -> the error
is
here, when I open the file
for
the 2nd time
if
(pbtiff.Image !=
null
)
{
pbtiff.Image.Dispose();
}
pbtiff.Image = System.Drawing.Image.FromStream(fileStream);
SplitTiffFinal(fileStream);
filestiff = GetFilesFinal();
up.Visible =
true
;
up.Enabled =
false
;
down.Visible =
true
;
}
}
}
}
Can you help me figure out what is the probem, if it works the first time?
Reply
Answers (
2
)
submit form & view the data in asp.net with database
can we use more then one selected index change in gridview?