lakkadghat Posted September 6, 2003 Posted September 6, 2003 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: Quote
*Experts* Nerseus Posted September 8, 2003 *Experts* Posted September 8, 2003 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 Quote "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
lakkadghat Posted September 10, 2003 Author Posted September 10, 2003 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@ Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.