Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

vb fux up yo [code]

Name: Anonymous 2006-02-07 17:15

so yeah. i'm writing my first evar real program in VB, and everything's going swimmingly, but for some reason VB locks up on me when i try and run this program and activate this sequence of code:

Public Sub recwrite()
Dim n As Integer
Dim g As Integer
planet1.galaxy = galaxytext.Text
planet1.ssystem = ssystemtext.Text
planet1.planet = planettext.Text
planet1.owner = ownertext.Text
planet1.name = Nametext.Text
planet1.rating = ratingtext.Text
Call idassigner(g)
planet1.id = g
Open App.Path & "\planetdatabase.ogf" For Random As #1 Len = Len(planet1)
n = LOF(1) / Len(planet1)
Put #1, n + 1, planet1
Close #1
End Sub

Private Sub idassigner(ByRef g As Integer)
Open App.Path & "\planetdatabase.ogf" For Random As #1 Len = Len(planet1)
Dim n As Integer 'this is the number of records
Dim i As Integer 'this is the record being looked at currently
n = LOF(1) / Len(planet1)
i = 1
g = 1
Get #1, i, planet1
Do
    Get #1, i, planet1
    If planet1.id = g Then g = g + 1 And i = 1
    If planet1.id <> g Then i = i + 1
Loop Until i > n
Close #1
End Sub

i've figured that the problem occurs either at the loop until i > n part or the close #1 part. i'm using VB 6.0  help 'preciated.

Name: Anonymous 2006-02-07 18:01

If "VB locks up" and this is your "first evar real program in VB," I'm voting for an infinite loop.  Use the debugger to figure out why i is always <= n @ your test.  I don't want to read it enough to actually figure it out.

Name: Anonymous 2006-02-07 18:03

Your problem may be in this line of code:

If planet1.id = g Then g = g + 1 And i = 1

Name: Anonymous 2009-11-21 17:14

From a Jew's face
The wicked Devil speaks to us,
The Devil who, in every country,
Is known as an evil plague.

Would we from the Jew be free,
Again be cheeful and happy,
Then must youth fight with us
To get rid of the Jewish Devil.

Name: Anonymous 2009-11-21 17:37

>>3
What happened to the indentation?

Name: Anonymous 2009-11-21 17:44

>>5
It was forced XD

Name: Anonymous 2009-11-21 18:55

From a Jew's face
The wicked Devil speaks to us,
The Devil who, in every country,
Is known as an evil plague.

Would we from the Jew be free,
Again be cheeful and happy,
Then must youth fight with us
To get rid of the Jewish Devil.

Name: Anonymous 2010-11-25 6:49

Name: Anonymous 2010-12-05 20:29

>>9
Hi.

Don't change these.
Name: Email:
Entire Thread Thread List