Click here to Skip to main content
15,942,964 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Connection String In App Config VS 2005 Pin
Polymorpher16-May-07 7:05
Polymorpher16-May-07 7:05 
QuestionGeneric Error In GDI+ Pin
MatrixCoder15-May-07 14:47
MatrixCoder15-May-07 14:47 
AnswerRe: Generic Error In GDI+ Pin
Sathesh Sakthivel15-May-07 16:47
Sathesh Sakthivel15-May-07 16:47 
GeneralRe: Generic Error In GDI+ Pin
MatrixCoder15-May-07 17:20
MatrixCoder15-May-07 17:20 
GeneralRe: Generic Error In GDI+ Pin
Polymorpher15-May-07 17:47
Polymorpher15-May-07 17:47 
GeneralRe: Generic Error In GDI+ Pin
MatrixCoder15-May-07 18:12
MatrixCoder15-May-07 18:12 
GeneralRe: Generic Error In GDI+ Pin
Polymorpher15-May-07 18:14
Polymorpher15-May-07 18:14 
QuestionFile in use error while renaming file Pin
Steve Erbach15-May-07 11:46
Steve Erbach15-May-07 11:46 
Dear Group,

Here's what my app is attempting:

1) rename a JPEG file temporarily
2) create a thumbnail for that JPEG
3) save the thumbnail in a separate folder
4) rename the JPEG file back to its original name

1), 2), and 3) work fine. 4) is where I have the problem. My program halts with this error:

"The process cannot access the file because it is being used by another process."

Here's the code:

' Step 1)
My.Computer.FileSystem.RenameFile("TestImage.jpg, _
   "TestImage.jpg.working")
' Step 2)
Dim bmpSS As Bitmap
Dim intBW As Integer   ' thumbnail width
Dim intBH As Integer   ' thumbnail height
Dim bmp As Bitmap = New Bitmap("TestImage.jpg.working")
bmpSS = New Bitmap(250, CInt(bmp.Height / (bmp.Width / 250)), _
   Imaging.PixelFormat.Format32bppArgb)
intBW = bmpSS.Width
intBH = bmpSS.Height
Dim g As Graphics = Graphics.FromImage(bmpSS)
g.DrawImage(Bmp, 0, 0, intBW, intBH)
' Step 3)
bmpSS.Save("C:\Temp\TestImage_250.jpg")
g = Nothing
bmp = Nothing
bmpSS = Nothing
' Step 4)
My.Computer.FileSystem.RenameFile("TestImage.jpg.working", _
   "TestImage.jpg")


As I said, it all works until it hits step 4). Is there some locking issue that I'm missing here?

Regards,

Steve Erbach
Neenah, WI
http://TheTownCrank.blogspot.com
AnswerRe: File in use error while renaming file Pin
Christian Graus15-May-07 12:15
protectorChristian Graus15-May-07 12:15 
GeneralRe: File in use error while renaming file Pin
Steve Erbach16-May-07 3:34
Steve Erbach16-May-07 3:34 
Questionhow to convert the following code to vb.net Pin
awara15-May-07 11:44
awara15-May-07 11:44 
AnswerRe: how to convert the following code to vb.net Pin
MatrixCoder15-May-07 12:07
MatrixCoder15-May-07 12:07 
AnswerRe: how to convert the following code to vb.net Pin
Dave Doknjas15-May-07 12:18
Dave Doknjas15-May-07 12:18 
Questionhow to convert the following code to vb.net Pin
awara15-May-07 11:44
awara15-May-07 11:44 
AnswerRe: how to convert the following code to vb.net Pin
nlarson1116-May-07 11:15
nlarson1116-May-07 11:15 
QuestionWindows Installer Condition sytax Pin
Karma3125115-May-07 8:42
Karma3125115-May-07 8:42 
AnswerRe: Windows Installer Condition sytax Pin
Joseph Guadagno15-May-07 11:51
Joseph Guadagno15-May-07 11:51 
GeneralRe: Windows Installer Condition sytax Pin
Karma3125117-May-07 9:16
Karma3125117-May-07 9:16 
GeneralRe: Windows Installer Condition sytax Pin
Joseph Guadagno17-May-07 12:22
Joseph Guadagno17-May-07 12:22 
QuestionFavorite free toolbox controls? Pin
gdijim15-May-07 8:27
gdijim15-May-07 8:27 
QuestionRemoving an object from a list Pin
steve_rm15-May-07 8:06
steve_rm15-May-07 8:06 
AnswerRe: Removing an object from a list Pin
Dave Kreskowiak15-May-07 10:18
mveDave Kreskowiak15-May-07 10:18 
QuestionMarshalling Variable-Size Array Pin
VFaul15-May-07 7:49
VFaul15-May-07 7:49 
AnswerRe: Marshalling Variable-Size Array Pin
Dave Kreskowiak15-May-07 10:12
mveDave Kreskowiak15-May-07 10:12 
QuestionNotifyIcon and ContextMenuStrip Pin
viperbyte65015-May-07 5:54
viperbyte65015-May-07 5:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.