Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

hello everyone

i am facing problem if anyone can just slove it for me.

the problem is that i have two file, in one file

when have a file select dialog box which allows user to select his photograph.

now once the photograph is selected, and next from is opened it shows error locating file

in the second form where i am reading from a text file.

 

the problem is that while it is searching for the text file in form2

it searches in the location from where the picture was selected

example if the photograph was selected was "D:\Pics\london\pic1.jpg"

then while the form1 is closed using form1.hide and form2.show then it shows the error

"D:\pics\london\ldb.txt not found"

 

can anyone please tell me what the problem is

 

'form1

Private Sub OpenPicDialog()

Dim OpenDialog As New OpenFileDialog()

OpenDialog.InitialDirectory = "D:\"

OpenDialog.FileName = ""

OpenDialog.DefaultExt = "jpg"

OpenDialog.Filter = "Jpg Files(*.jpg)|*.jpg|Gif Files(*.gif)|*.gif"

OpenDialog.CheckFileExists = True

OpenDialog.CheckPathExists = True

 

Dim ResultDialog As DialogResult = OpenDialog.ShowDialog()

If Not OpenDialog.FileName.EndsWith(".jpg") And Not OpenDialog.FileName.EndsWith(".gif") And Not _ OpenDialog.FileName.EndsWith(".GIF") And Not OpenDialog.FileName.EndsWith(".JPG") Then

MessageBox.Show("Please Upload JPEG & GIF Files ONLY", "At-Taiseer", MessageBoxButtons.OK)

ElseIf ResultDialog = DialogResult.OK Then

resumepic.Image = Image.FromFile(OpenDialog.FileName)

strfilename = OpenDialog.FileName

End If

dim frm as new form2

frm.show

me.hide

 

End Sub 'OpenPicDialog

 

 

 

'form2

Dim sr As StreamReader

Dim srmoze As String

Dim arrldb() As String

sr = New StreamReader("Ldb.txt")

srmoze = sr.ReadLine()

sr.Close()

 

 

mU$t@f@:confused:

  • *Experts*
Posted

I'm not quite sure what you're trying to do with the ldb.txt file? Why would you assume it's in the same path as the JPG they selected? Could you give some more info?

 

-Ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

i think there is some confusion.

my text file is in the directory where the software exe is running but it searches it in direcoty where the jpeg was selected from.

 

i think there is some initialisation problem.

 

Mu$t@f@

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...