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
durga prasad
NA
54
0
Cannot load image file - Out of memory exception
Jan 20 2009 4:12 AM
Hi,
I am not able to load an image , I am getting out of memory exception. The image size is only 70kb.I am fetching the image locally, then saving the image in application directory.I am the saving the location in database .Then fetching the image , while fetching the image I am getting out of memory exception.I should not crop the images.
/** Add Image **/
private void btnaddimage_Click(object sender, EventArgs e)
{
btnaddimage.Enabled = false;
if (ofdfiledialog.ShowDialog() == DialogResult.OK)
{
txtimages.Image = Image.FromFile(ofdfiledialog.FileName);
text1.Text =ofdfiledialog.FileName;
string fileName = this.ofdfiledialog.FileName;
text1.Text = fileName;
fileName = fileName.Substring(fileName.LastIndexOf("\\") +1);
text2.Text = fileName;
}
/** Save image**/
private void BtnSave_Click(object sender, EventArgs e)
{
try
{
if (dbfCmbImageType.Text == "")
{
MessageBox.Show("Mandatory Fields are Not Filled");
}
else
{
strFilePath = Application.ExecutablePath;
txtimages.Image.Save(strFilePath + text2.Text, System.Drawing.Imaging.ImageFormat.Jpeg);
str1 = strFilePath;
str2 = text2.Text;
dbfTxtImageURL.Text = str1;
dbfTxtImage.Text = str2;
txtimages.Image = null;
}
}
catch (Exception e1)
{
MessageBox.Show(e1.Message);
}
}
}
//** Load Image**/
Path = dbfTxtImageURL.Text;
txtimages.Image = System.Drawing.Image.FromFile(Path);
//Out of memory
Thanks in Advance,
A.Durga Prasad
Reply
Answers (
0
)
String Format
Unable to stop a windows service on the local computer