VB.NET School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 300,337 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,660 people online right now. Registration is fast and FREE... Join Now!




after build exe

 

after build exe, a error msg occurs

ankiesiau

24 May, 2009 - 06:41 PM
Post #1

New D.I.C Head
*

Joined: 22 May, 2009
Posts: 17

After i build the database at desktop, a setup occurs in my desktop.when i click the setup to install.Then i get a new program at my startup, and i click the new installed program, i get this error message.

At the details,

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.FileNotFoundException: Could not find file 'C:\Documents and Settings\welight_meng\Local Settings\Apps\2.0\X7OYGH9Z.28D\Y69OHDD9.MJB\labd..tion_37c629b09a2d04a0_0002.0001_414f206230faced4\mystudents.txt'.
File name: 'C:\Documents and Settings\welight_meng\Local Settings\Apps\2.0\X7OYGH9Z.28D\Y69OHDD9.MJB\labd..tion_37c629b09a2d04a0_0002.0001_414f206230faced4\mystudents.txt'
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path)
at System.IO.File.OpenText(String path)
at makmal.Form3.Form3_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Lab Database
Assembly Version: 1.0.3430.38035
Win32 Version: 1.0.3430.38035
CodeBase: file:///C:/Documents%20and%20Settings/welight_meng/Local%20Settings/Apps/2.0/X7OYGH9Z.28D/Y69OHDD9.MJB/labd..tion_37c629b09a2d04a0_0002.0001_414f206230faced4/Lab%20Database.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Anyone help me?i can provide the code if anyone want the code for further information.





Attached thumbnail(s)
Attached Image
User is offlineProfile CardPM
+Quote Post


searockruz

RE: After Build Exe

24 May, 2009 - 10:44 PM
Post #2

D.I.C Regular
***

Joined: 7 Mar, 2009
Posts: 459



Thanked: 23 times
My Contributions
have you included the mystudents.txt file in your setup

have you checked where is the file is placed after it gets installed

post your code so that i can help you
User is offlineProfile CardPM
+Quote Post

ankiesiau

RE: After Build Exe

25 May, 2009 - 01:08 AM
Post #3

New D.I.C Head
*

Joined: 22 May, 2009
Posts: 17

QUOTE(searockruz @ 24 May, 2009 - 10:44 PM) *

have you included the mystudents.txt file in your setup

have you checked where is the file is placed after it gets installed

post your code so that i can help you


CODE
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        If NotFirstTime = False Then
            NotFirstTime = True
            Me.Hide()     'Me refers to the form you are on
            secondForm.ShowDialog()
            End
        End If




        TextBox8.Text = "None"
        Dim sr As IO.StreamReader = IO.File.OpenText("mystudents.txt")
        Dim z, k As Integer
        Dim temp As String
        Dim i As Integer
        numcourses = 0
        arraysize = 0
        ListBox2.Items.Clear()



User is offlineProfile CardPM
+Quote Post

searockruz

RE: After Build Exe

25 May, 2009 - 01:13 AM
Post #4

D.I.C Regular
***

Joined: 7 Mar, 2009
Posts: 459



Thanked: 23 times
My Contributions
make sure that mystudents.txt file is in the same folder of your exe
User is offlineProfile CardPM
+Quote Post

ankiesiau

RE: After Build Exe

25 May, 2009 - 01:27 AM
Post #5

New D.I.C Head
*

Joined: 22 May, 2009
Posts: 17

QUOTE(searockruz @ 25 May, 2009 - 01:13 AM) *

make sure that mystudents.txt file is in the same folder of your exe


i hv try to put the students.txt file with exe but the error msg still occurs.
User is offlineProfile CardPM
+Quote Post

searockruz

RE: After Build Exe

25 May, 2009 - 01:31 AM
Post #6

D.I.C Regular
***

Joined: 7 Mar, 2009
Posts: 459



Thanked: 23 times
My Contributions
are you sure you have added the text file to your setup.And if you have added it just check it goes in the same folder where exe gets installed
User is offlineProfile CardPM
+Quote Post

ankiesiau

RE: After Build Exe

25 May, 2009 - 02:19 AM
Post #7

New D.I.C Head
*

Joined: 22 May, 2009
Posts: 17

QUOTE(searockruz @ 25 May, 2009 - 01:31 AM) *

are you sure you have added the text file to your setup.And if you have added it just check it goes in the same folder where exe gets installed


HERE


Attached thumbnail(s)
Attached Image Attached Image
User is offlineProfile CardPM
+Quote Post

AdamSpeight2008

RE: After Build Exe

25 May, 2009 - 02:41 AM
Post #8

The Bandido Coder
Group Icon

Joined: 29 May, 2008
Posts: 2,684



Thanked: 155 times
Dream Kudos: 3925
Expert In: vb.net, LINQ

My Contributions
There not in the same folder. If you look at the second screen shot, I'll see the its a shortcut to the exe.
User is online!Profile CardPM
+Quote Post

ankiesiau

RE: After Build Exe

25 May, 2009 - 04:37 AM
Post #9

New D.I.C Head
*

Joined: 22 May, 2009
Posts: 17

QUOTE(AdamSpeight2008 @ 25 May, 2009 - 02:41 AM) *

There not in the same folder. If you look at the second screen shot, I'll see the its a shortcut to the exe.


Problem solved.Thanks.

This post has been edited by ankiesiau: 25 May, 2009 - 05:02 AM
User is offlineProfile CardPM
+Quote Post

searockruz

RE: After Build Exe

25 May, 2009 - 04:49 AM
Post #10

D.I.C Regular
***

Joined: 7 Mar, 2009
Posts: 459



Thanked: 23 times
My Contributions
first tell me how you created your setup
User is offlineProfile CardPM
+Quote Post

ankiesiau

RE: After Build Exe

25 May, 2009 - 05:06 AM
Post #11

New D.I.C Head
*

Joined: 22 May, 2009
Posts: 17

QUOTE(searockruz @ 25 May, 2009 - 04:49 AM) *

first tell me how you created your setup


my problems solved by run and type the destination file.
But i want delete the student.txt and run the program smoothly.Can u help me?

CODE
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim sr As IO.StreamReader = IO.File.OpenText("mystudents.txt")
        Dim z, k As Integer
        Dim temp As String
        Dim i As Integer
        RadioButton1.Enabled = True
        GroupBox2.Enabled = False
        GroupBox1.Enabled = True
        

        indexValue = 0
        numcourses = 0
        arraysize = 0
        ListBox2.Items.Clear()


        RadioButton1.Checked = True
        Do While sr.Peek <> -1

            students(z).last = UCase(sr.ReadLine)
            students(z).first = UCase(sr.ReadLine)
            students(z).semester = UCase(sr.ReadLine)
            students(z).HSgradyear = UCase(sr.ReadLine)
            students(z).yearslastmath = UCase(sr.ReadLine)
            students(z).IDnumber = UCase(sr.ReadLine)
            students(z).CCstudent = UCase(sr.ReadLine)

            ReDim Preserve students(z).courses(7)
            For i = 0 To 7
                students(z).courses(i).coursenumber = UCase(sr.ReadLine)
                students(z).courses(i).instructor = UCase(sr.ReadLine)
            Next i
            students(z).otherschool = UCase(sr.ReadLine)
            students(z).nameschool = UCase(sr.ReadLine)
            students(z).StudentVisits = students(z).StudentVisits
            ListBox2.Items.Add("Record #" & Str(z + 1))
            ListBox2.Items.Add("Last: " & "" & students(z).last)
            ListBox2.Items.Add("First: " & "" & students(z).first)
            ListBox2.Items.Add("Semester " & "" & students(z).semester)
            ListBox2.Items.Add("Years : " & "" & students(z).HSgradyear)
            ListBox2.Items.Add("Hours In Lab " & "" & students(z).yearslastmath)
            ListBox2.Items.Add("ID#: " & "" & students(z).IDnumber)
            ListBox2.Items.Add("CC Students: " & "" & students(z).CCstudent)
            '**********************************************
            For k = 0 To 7
                temp = Str(k + 1) & "). " & students(z).courses(k).coursenumber & " " & students(z).courses(k).instructor
                ListBox2.Items.Add(temp)
            Next k
            ListBox2.Items.Add("Otherschool: " & "" & students(z).otherschool)
            ListBox2.Items.Add("Name of School: " & "" & students(z).nameschool)
            z = z + 1
            ListBox2.Items.Add("*******************************************")
            '**********************************************
        Loop

        arraysize = z
        sr.Close()
    End Sub

User is offlineProfile CardPM
+Quote Post

searockruz

RE: After Build Exe

25 May, 2009 - 05:19 AM
Post #12

D.I.C Regular
***

Joined: 7 Mar, 2009
Posts: 459



Thanked: 23 times
My Contributions
dude theres nothing wrong with your code

you are forgetting to include your text file with other files
thats the reason your exe cannot find the text file [after installation]

the error exists in your setup,you have not created it properly

and you should include your code in try catch blocks

CODE

Try

Dim sr As IO.StreamReader = IO.File.OpenText("mystudents.txt")

Catch
MessageBox.Show("Cannot find text file","Error")
End Try


so that your application wont quit after error

This post has been edited by searockruz: 25 May, 2009 - 05:20 AM
User is offlineProfile CardPM
+Quote Post

ankiesiau

RE: After Build Exe

25 May, 2009 - 05:59 AM
Post #13

New D.I.C Head
*

Joined: 22 May, 2009
Posts: 17

QUOTE(searockruz @ 25 May, 2009 - 05:19 AM) *

dude theres nothing wrong with your code

you are forgetting to include your text file with other files
thats the reason your exe cannot find the text file [after installation]

the error exists in your setup,you have not created it properly

and you should include your code in try catch blocks

CODE

Try

Dim sr As IO.StreamReader = IO.File.OpenText("mystudents.txt")

Catch
MessageBox.Show("Cannot find text file","Error")
End Try


so that your application wont quit after error


THX.I want to ask how to include the text file with other files?


This post has been edited by ankiesiau: 25 May, 2009 - 06:29 AM
User is offlineProfile CardPM
+Quote Post

searockruz

RE: After Build Exe

25 May, 2009 - 09:15 AM
Post #14

D.I.C Regular
***

Joined: 7 Mar, 2009
Posts: 459



Thanked: 23 times
My Contributions
Error handling for beginners

Setup tutorial

if you have a problem post back

This post has been edited by searockruz: 25 May, 2009 - 09:19 AM
User is offlineProfile CardPM
+Quote Post

ankiesiau

RE: After Build Exe

25 May, 2009 - 07:27 PM
Post #15

New D.I.C Head
*

Joined: 22 May, 2009
Posts: 17

QUOTE(searockruz @ 25 May, 2009 - 09:15 AM) *

Error handling for beginners

Setup tutorial

if you have a problem post back


i still don't understood and don't hv File System editor.

This post has been edited by ankiesiau: 25 May, 2009 - 08:24 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 05:09PM

Live VB.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month