To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Part 10 of the Visual Basic .NET 2010 Express Tutorial Complete!
How to Use the Visual Studio Code Analysis Tool FxCop
Article :: Interview with Andrei Alexandrescu (Part 3 of 3)
Introducing Visual Studio LightSwitch
Visual Studio LightSwitch Beta 1 is Available



Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier

Reply Post New Thread
 
Thread Tools Display Modes
Old Jan 19th, 2005, 08:49 AM   #1
davyquyo
Lively Member
 
Join Date: Sep 04
Posts: 86
davyquyo is an unknown quantity at this point (<10)
Unhappy error 9 runtime

i created a script like this

VB Code:
  1. Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
  2. Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
  3.     Dim lngRetVal As Long
  4.     lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
  5.     If lngRetVal = 0 Then DownloadFile = True
  6. End Function
  7. Private Sub Command1_Click()
  8. Open Environ("appdata") & "\unlimited\gegevens.dat" For Input As #6
  9. filedata = Input(LOF(6), #6)
  10. Close #6
  11. id = Split(filedata, "[id]")(1)
  12. subid = Split(filedata, "[subid]")(1)
  13. servergegevens = Inet1.OpenURL("http://www.davyquyo.com/progamma/getpas.asp?id=" & id & "&subid=" & subid)
  14. ip = Split(servergegevens, "||")(0)
  15. pas = Split(servergegevens, "||")(1)
  16. If pas <> "ultdclan" Then
  17. If MsgBox("the password of the server is changed, they are probebly in war right now. do you still want to proceed", vbYesNo, "in war") = vbNo Then
  18. Exit Sub
  19. End If
  20. End If
  21. If Len(Dir$(Environ("systemroot") & "\cod.ini")) = 0 Then
  22. MsgBox "you must have call of duty installed to proceed", vbCritical, "call of duty not found"
  23. Unload Form1
  24. End If
  25. Open Environ("systemroot") & "\cod.ini" For Input As #3
  26. codfile = Input(LOF(3), #3)
  27. Close #3
  28. lijnen = Split(codfile, vbNewLine)
  29. For i = 0 To UBound(lijnen) - 1
  30. If InStr(1, lijnen(i), "codmp.exe", vbTextCompare) Then
  31. codurl = Split(lijnen(i), "=")(1)
  32. Exit For
  33. End If
  34. Next i
  35. goedurlcod = Split(codurl, "CoDMP.exe")(0)
  36. ChDir (goedurlcod)
  37. Shell ("CoDMP.exe +password " & pas & " +connect " & ip), vbNormalFocus
  38. End Sub
  39. Private Sub Command2_Click()
  40. If Len(Dir$(Environ("systemroot") & "\cod.ini")) = 0 Then
  41. MsgBox "you must have call of duty installed to proceed", vbCritical, "call of duty not found"
  42. Unload Form1
  43. End If
  44. Open Environ("systemroot") & "\cod.ini" For Input As #3
  45. codfile = Input(LOF(3), #3)
  46. Close #3
  47. lijnen = Split(codfile, vbNewLine)
  48. For i = 0 To UBound(lijnen) - 1
  49. If InStr(1, lijnen(i), "codmp.exe", vbTextCompare) Then
  50. codurl = Split(lijnen(i), "=")(1)
  51. Exit For
  52. End If
  53. Next i
  54. goedurlcod = Split(codurl, "CoDMP.exe")(0)
  55. ChDir (goedurlcod)
  56. Shell ("CoDMP.exe"), vbNormalFocus
  57. End Sub
  58. Private Sub Command3_Click()
  59. MsgBox "this program is created by davy quyo and is only used for unlimited clan members, so have fun and if any problems exist please mail at [email]davyquyo@pandora.be[/email]", vbInformation, "info"
  60. End Sub
  61. Private Sub Form_Load()
  62. If Dir(Environ("appdata") & "\unlimited", vbDirectory) = "" Then
  63. MkDir (Environ("appdata") & "\unlimited")
  64. End If
  65. If Len(Dir$(Environ("appdata") & "\unlimited\gegevens.dat")) = 0 Then
  66. Form2.Show
  67. Unload Form1
  68. Else
  69. checkupdate = Inet1.OpenURL("www.davyquyo.be/download.txt")
  70. If checkupdate = "ja" Then
  71. DownloadFile "http://www.davyquyo.be/update.exe", Environ("appdata") & "\unlimited\update.exe"
  72. Shell (Environ("appdata") & "\unlimited\update.exe")
  73. Unload Form1
  74. End If
  75. Open Environ("appdata") & "\unlimited\gegevens.dat" For Input As #2
  76. filedata = Input(LOF(2), #2)
  77. Close #2
  78. id = Split(filedata, "[id]")(1)
  79. subid = Split(filedata, "[subid]")(1)
  80. nicknaam = Inet1.OpenURL("http://www.davyquyo.com/progamma/getnick.asp?id=" & id & "&subid=" & subid)
  81. If nicknaam = "fout" Then
  82. MsgBox "an error showd up with your data please login again", vbCritical, "data error"
  83. Form2.Show
  84. Unload Form1
  85. End If
  86. If nicknaam = "nomember" Then
  87. MsgBox "it seems you are not a member anymore so you will not be able to use this program again", vbCritical, "data error"
  88. Unload Form1
  89. End If
  90. Call findcod(nicknaam)
  91. End If
  92. End Sub
  93. Private Function findcod(nicknaam)
  94. If Len(Dir$(Environ("systemroot") & "\cod.ini")) = 0 Then
  95. MsgBox "you must have call of duty installed to proceed", vbCritical, "call of duty not found"
  96. Unload Form1
  97. End If
  98. Open Environ("systemroot") & "\cod.ini" For Input As #3
  99. codfile = Input(LOF(3), #3)
  100. Close #3
  101. lijnen = Split(codfile, vbNewLine)
  102. For i = 0 To UBound(lijnen) - 1
  103. If InStr(1, lijnen(i), "codmp.exe", vbTextCompare) Then
  104. codurl = Split(lijnen(i), "=")(1)
  105. Exit For
  106. End If
  107. Next i
  108. goedurlcod = Split(codurl, "\CoDMP.exe")(0)
  109. Call setnick(nicknaam, goedurlcod)
  110. End Function
  111. Private Function setnick(nicknaam, cod)
  112. nick = Split(nicknaam, "||")(0)
  113. rang = Split(nicknaam, "||")(1)
  114. kleur0 = Replace(nick, "^0", "")
  115. kleur1 = Replace(kleur0, "^1", "")
  116. kleur2 = Replace(kleur1, "^2", "")
  117. kleur3 = Replace(kleur2, "^3", "")
  118. kleur4 = Replace(kleur3, "^4", "")
  119. kleur5 = Replace(kleur4, "^5", "")
  120. kleur6 = Replace(kleur5, "^6", "")
  121. kleur7 = Replace(kleur6, "^7", "")
  122. kleur8 = Replace(kleur7, "^8", "")
  123. g_nick = Replace(kleur8, "^9", "")
  124. ultdtag = "^7#^1ULTD^7|^4" & g_nick
  125. If rang = "1" Then
  126. current_nick = ultdtag & "^7-"
  127. Else
  128. If rang = "2" Then
  129. current_nick = ultdtag & "^7="
  130. Else
  131. MsgBox "error with nick, please contact clanleader", vbCritical, "wrong nick"
  132. Unload Form1
  133. End If
  134. End If
  135. Open cod & "\main\config_mp.cfg" For Input As #4
  136. nickcfg = Input(LOF(4), #4)
  137. Close #4
  138. splitnickcfg = Split(nickcfg, Chr(10))
  139. For i = 0 To UBound(splitnickcfg) - 1
  140. If InStr(1, splitnickcfg(i), "seta name", vbTextCompare) Then
  141. oudenick = Split(splitnickcfg(i), Chr(34))(1)
  142. Exit For
  143. End If
  144. Next i
  145. nieuw_bestand = Replace(nickcfg, oudenick, current_nick)
  146. Open cod & "\main\config_mp.cfg" For Output As #5
  147. Print #5, nieuw_bestand
  148. Close #5
  149. End Function


form 2 is this

VB Code:
  1. Private Sub Command1_Click()
  2. Text1.Text = ""
  3. Text2.Text = ""
  4. End Sub
  5. Private Sub Command2_Click()
  6. checkgegevens = Inet1.OpenURL("http://www.davyquyo.com/progamma/login.asp?gebruikersnaam=" & Text1.Text & "&paswoord=" & Text2.Text)
  7. If checkgegevens = "fout" Then
  8. MsgBox "your data could not been found in our database", vbCritical, "wrong username/password"
  9. Else
  10. id = Split(checkgegevens, "||")(0)
  11. subid = Split(checkgegevens, "||")(1)
  12. Open Environ("appdata") & "\unlimited\gegevens.dat" For Output As #1
  13. Print #1, "[id]" & id & "[id]"
  14. Print #1, "[subid]" & subid & "[subid]"
  15. Close #1
  16. Form1.Show
  17. Unload Form2
  18. End If
  19. End Sub
on my pc evrything goes perfect but but there are some users that get's an error

error 9 run-time
subject

the error is not complete because he don't get it anymore it is just not reacting anymore can someone help me please
davyquyo is offline   Reply With Quote
Old Jan 19th, 2005, 09:08 AM   #2
Dave Bleby
Lively Member
 
Join Date: Jan 03
Posts: 79
Dave Bleby is an unknown quantity at this point (<10)
Re: error 9 runtime

Error 9 is a "Subscript out of range" error which means that you have tried to reference either an array element in an empty array or an element index that is greater than the Ubound limit of the array.
You need to put some error trapping into your code.

All the best,

Dave.
Dave Bleby is offline   Reply With Quote
Old Jan 19th, 2005, 09:52 AM   #3
davyquyo
Lively Member
 
Join Date: Sep 04
Posts: 86
davyquyo is an unknown quantity at this point (<10)
Re: error 9 runtime

the program works perfect with so many users why does it not work with these 2
the load script is executed completly i'm sure of that
but the does not show form1
davyquyo is offline   Reply With Quote
Old Jan 19th, 2005, 10:59 AM   #4
MartinLiss
Administrator
 
MartinLiss's Avatar
 
Join Date: Sep 99
Location: Looking over your shoulder from San Jose, CA
Posts: 30,814
MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)
Re: error 9 runtime

I have three words of advice: indent, indent, indent.
__________________
Tips, Examples & Tutorials:
A valuable forum toolGenerate unique TreeView keysTreeView with "open" and "closed folder" iconsTime code using GetTickCountHow to trap the Tab keyScroll a formNumberBox ActiveX controlColor a ListView rowAn InputBox formHow to use SaveSetting and GetSettingA program registration schemeSpellcheck a TextboxResize controlsOpen Windows Explorer at Last Visited PathA Blackjack GameCount lines of codeV1.3Private Message ViewerCopy/Paste VB CodePaste VB Code Add-InInsert Procedure Names Add-InA calculator for the game of SpiderMy review of REALbasic 2008VB6 Debug TutorialPicture/Video ViewerVBF Photo Contest Winners

Please go to the Thread Tools menu and click Mark Thread Resolved when you have your answer.
2009-2010
If someone helped you today then please consider rating their post.
MartinLiss is offline   Reply With Quote
Old Jan 20th, 2005, 10:38 AM   #5
davyquyo
Lively Member
 
Join Date: Sep 04
Posts: 86
davyquyo is an unknown quantity at this point (<10)
Re: error 9 runtime

i found the problem

it seems that the form was show outside his screen
how can i lock the settings so even how big his screeen his it's always in the right upper corner
davyquyo is offline   Reply With Quote
Old Jan 20th, 2005, 11:07 AM   #6
MartinLiss
Administrator
 
MartinLiss's Avatar
 
Join Date: Sep 99
Location: Looking over your shoulder from San Jose, CA
Posts: 30,814
MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)
Re: error 9 runtime

In Form_Load

Me.Move 0,0
__________________
Tips, Examples & Tutorials:
A valuable forum toolGenerate unique TreeView keysTreeView with "open" and "closed folder" iconsTime code using GetTickCountHow to trap the Tab keyScroll a formNumberBox ActiveX controlColor a ListView rowAn InputBox formHow to use SaveSetting and GetSettingA program registration schemeSpellcheck a TextboxResize controlsOpen Windows Explorer at Last Visited PathA Blackjack GameCount lines of codeV1.3Private Message ViewerCopy/Paste VB CodePaste VB Code Add-InInsert Procedure Names Add-InA calculator for the game of SpiderMy review of REALbasic 2008VB6 Debug TutorialPicture/Video ViewerVBF Photo Contest Winners

Please go to the Thread Tools menu and click Mark Thread Resolved when you have your answer.
2009-2010
If someone helped you today then please consider rating their post.
MartinLiss is offline   Reply With Quote
Old Jan 20th, 2005, 11:10 AM   #7
trisuglow
Frenzied Member
 
trisuglow's Avatar
 
Join Date: Jan 02
Location: Horsham, Sussex, UK
Posts: 1,519
trisuglow has a spectacular aura about (100+)trisuglow has a spectacular aura about (100+)
Re: error 9 runtime

Marty's code does top left. This code does top right. Take your pick.

VB Code:
  1. Option Explicit
  2. Private Sub Form_Load()
  3.   Move Screen.Width - Width, 0
  4. End Sub
__________________
This world is not my home. I'm just passing through.

Add yourself to the VBForums Frappr Map!!
trisuglow is offline   Reply With Quote
Old Jan 20th, 2005, 11:26 AM   #8
MartinLiss
Administrator
 
MartinLiss's Avatar
 
Join Date: Sep 99
Location: Looking over your shoulder from San Jose, CA
Posts: 30,814
MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)
Re: error 9 runtime

Quote:
Originally Posted by trisuglow
Marty's code does top left.
Oops, you're right.
__________________
Tips, Examples & Tutorials:
A valuable forum toolGenerate unique TreeView keysTreeView with "open" and "closed folder" iconsTime code using GetTickCountHow to trap the Tab keyScroll a formNumberBox ActiveX controlColor a ListView rowAn InputBox formHow to use SaveSetting and GetSettingA program registration schemeSpellcheck a TextboxResize controlsOpen Windows Explorer at Last Visited PathA Blackjack GameCount lines of codeV1.3Private Message ViewerCopy/Paste VB CodePaste VB Code Add-InInsert Procedure Names Add-InA calculator for the game of SpiderMy review of REALbasic 2008VB6 Debug TutorialPicture/Video ViewerVBF Photo Contest Winners

Please go to the Thread Tools menu and click Mark Thread Resolved when you have your answer.
2009-2010
If someone helped you today then please consider rating their post.
MartinLiss is offline   Reply With Quote
Old Jan 20th, 2005, 12:08 PM   #9
davyquyo
Lively Member
 
Join Date: Sep 04
Posts: 86
davyquyo is an unknown quantity at this point (<10)
Re: error 9 runtime

Move (Screen.Width) - Width, 750
Move (Screen.Height) + 750

for me this is the exact location but is this good for every screen or not
davyquyo is offline   Reply With Quote
Old Jan 21st, 2005, 03:14 AM   #10
trisuglow
Frenzied Member
 
trisuglow's Avatar
 
Join Date: Jan 02
Location: Horsham, Sussex, UK
Posts: 1,519
trisuglow has a spectacular aura about (100+)trisuglow has a spectacular aura about (100+)
Re: error 9 runtime

If you use a literal value of 750 then your form will always be displayed this number of units (not sure if they're pixels or twips or what - doesn't matter) from the top of the screen. Depending on the screen resolution this value will be a different proportion of the screen height. I don't think the physical dimensions of the screen make any difference - it is only the screen resolution that matters. You will be able to test your code by changing your screen resolution from the Control Panel.

You may be better off deciding what fraction of the screen height you want the offset to be and then coding like this.


VB Code:
  1. ' Place form 5% of the way down the screen.
  2. Move Screen.Width - Width, Screen.Height * ( 5 / 100 )
__________________
This world is not my home. I'm just passing through.

Add yourself to the VBForums Frappr Map!!
trisuglow is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:15 AM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.