I've searched this forum to see if anyone had the same problem I did but it's not quite the same. Whenever I open my program i get the "Too many line contunuations" error and then it tells me that there was an error in opening one of my forms. I then lose most of the code on this form.
Is there any way to retrieve the code I have a lost? Also, how can I stop this error from occuring?
To begin with you need to indent your statements. The way you have it makes it difficult to read. Now I took your above code snippit exactly as you posted it and I get error about Select Case without End Select.
I do not get any errors about too many continuation lines but that might be because I get the other errors first.
Here is your code indented
Code:
Private Sub Centre_Home_Information()
If centreinfo = True Then
Select Case frmMainHome.lblCentre.Caption
Case Is = "S.O'Neal"
frmPlayerScore.Caption = "Shaquille O'Neal"
PicPlayer.Picture = LoadPicture(App.Path & "\Oneal.jpg")
lblPlayerName.Caption = "Shaquille O'Neal"
lblPlayerPrice.Caption = "$19.2M"
lblPlayerPosition.Caption = "Centre"
lblPlayerTeam.Caption = "Phoenix Suns"
If scoreprocess = False Then
Else
lblPointsValue.Caption = onealpoints
lblPointsScore.Caption = onealpoints
lblReboundsValue.Caption = onealrebounds / 2
lblReboundsScore.Caption = onealrebounds
lblAssistsValue.Caption = onealassists / 2
lblAssistsScore.Caption = onealassists
lblTotalPoints.Caption = onealpoints + onealrebounds + onealassists
lblSeasonPoints.Caption = onealseason
lblGameNumber.Caption = gamenumber
If onealinjury > 0 Then
lblInjuryNumber.ForeColor = vbRed
lblInjuryNumber.Caption = onealinjury & " week(s) till return"
Else
lblInjuryNumber.ForeColor = vbGreen
lblInjuryNumber.Caption = "Fine"
End If
Select Case onealform
Case Is = -2
lblFormBlank.Visible = False
lblFormNumber.Caption = onealform
PicForm1.Picture = LoadPicture(App.Path & "\RedArrow.JPG")
PicForm2.Picture = LoadPicture(App.Path & "\RedArrow.JPG")
Case Is = -1
lblFormBlank.Visible = False
lblFormNumber.Caption = onealform
PicForm1.Picture = LoadPicture(App.Path & "\RedArrow.JPG")
PicForm2.Picture = LoadPicture(App.Path & "\Black.bmp")
Case Is = 0
lblFormBlank.Visible = True
lblFormNumber.Caption = ""
PicForm1.Picture = LoadPicture(App.Path & "\Black.bmp")
PicForm2.Picture = LoadPicture(App.Path & "\Black.bmp")
Case Is = 1
lblFormBlank.Visible = False
lblFormNumber.Caption = onealform
PicForm1.Picture = LoadPicture(App.Path & "\GreenArrow.JPG")
PicForm2.Picture = LoadPicture(App.Path & "\Black.bmp")
Case Is = 2
lblFormBlank.Visible = False
lblFormNumber.Caption = onealform
PicForm1.Picture = LoadPicture(App.Path & "\GreenArrow.JPG")
PicForm2.Picture = LoadPicture(App.Path & "\GreenArrow.JPG")
End Select
End If
End Sub
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
A single project can contain up to 32,000 "identifiers" (any nonreserved keyword), which include, but are not limited to, forms, controls, modules, variables, constants, procedures, functions, and objects. Note that the actual number of identifiers is limited to available memory.
Variable names in Visual Basic can be no longer than 255 characters, and the names of forms, controls, modules, and classes cannot be longer than 40 characters. Visual Basic imposes no limit on the actual number of distinct objects in a project.
Me thinks you should break it up somehow and reuse code where you can...
It also looks like you could use a datastore of some sort whether that is textfile, *.mdb, etc.
As far as I know the 'Too many line continuations' error is solely associated with 25+ line continuations (more than 24 consecutive lines ending in " _").
Are you sure there is no code anywhere in your project, including comments, which uses line continuations?
How do you feel about posting your project here?
Edit: I don't think it's your error but I agree with the vb5prgrmr, you should break your code up a bit. You can most likely do what you want without an enormous Select Case.
I'll post the snippet as it appears exactly as I have it in Visual Basic.
The code shows 10 players that can possibly be placed in a certain location, and this merely displays there stats for each player.
I have the indintations and I haven't used the underscore_ anywhere in my project.
Tell me if you want me to post a screenshot of the form aswell.
Thanks
Edit: vb5prgrmr, when you say identifiers, do you mean like any word that doesn't become blue font when you type it e.g. in my code snippet when I have "If scoreprocess = False Then", "scoreprocess" is one identifier?
Last edited by Dan_Dan_Man; Mar 10th, 2009 at 10:25 AM.
Did you fix your Select Case error? Maybe you don't have it in your project but it is in the sample you posted.
Last edited by jmsrickland; Mar 10th, 2009 at 10:27 AM.
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
Looking at your snippit file now and I do not see where you declare all these variables (i.e. identifiers). Are you using Option Explicit?
I really do not know where to start on how to make this code more usable without seeing the whole process you have created (don't need graphics if that helps you zip it smaller).
It looks, at first glance, that you have 7 or 8 variables per outer case statement, as part of the else of the if. So that is 357 * oh we'll say 10 just to make it easy = 3570 variables of what type? IF you are not using Option Explicit and just made these names up then they are of the varient type.
Look up variables, data types
Select Varient Data Type
Click on See Also
Select Data Type Summary
This is where you will find that the varient data type takes up more memory than the declared data type. For example the varient data type to be used as a string of variable length takes up 12 more bytes of memory and when the varient data type is used for numbers that can easily but put into integers, the varient uses 8 times as much memory...
While it may not look like it, that is a whole lot of memory being eaten up by varient variables (that is if you don't have all these variables declared somewhere) and I could be wrong... Nope I'm Not...
Procedures, Types, and Variables
There is no limit on the number of procedures per module. Each procedure can contain up to 64K of code. If a procedure or module exceeds this limit, Visual Basic generates a compile-time error. If you encounter this error, you can avoid it by breaking extremely large procedures into several smaller procedures, or by moving module-level declarations into another module.
Visual Basic uses tables to store the names of identifiers (variables, procedures, constants, and so on) in your code. Each table is limited to 64K.
Of which you are almost there if those are varients
I opened the code in microsoft word and it cuts off at the same part as in visual basic and notepad, but the rest of where the code should be is represented by squares.
I opened the code in microsoft word and it cuts off at the same part as in visual basic and notepad, but the rest of where the code should be is represented by squares.
Does that help at all?
Yes it does. Find that point in your text file and see if you have a square there. If so delete that SOB do a save as and give it a go but remember to try and break that code up some.
just the select case from the player name to the next select is 2940 bytes * 357 = 1049580 / 1024 = 1024.980 which is double the allowed 64kb in a single proceedure so even if you do get it to display correctly within VB, you will never get it to run.
Ya gotta break it up capt'n, she can't take ana more a this!
But what I don't get is it used to work. All I changed from when it worked to when it didn't work was I removed some code that I didn't need. Before you say this is the reason it doesn't work, I tested this change with one player before I did it with all 357 places and it worked fine. This error just popped up all of a sudden.
It doesn't matter how big, how many variables, or how many or how big anything is there is no way you are going to get a Too Many Line Continuations error without having too many continuations. Somewhere in your code you actually do have too many continuations or the compiler thinks you do for some reason. Any missing statement or out of place statement somewhere could cause the compiler to go off on a wild rampage and perhaps issue error messages that may or may not actually be the error in question.
Is it ok that I cry now?...
Only if you are a cry baby
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
It doesn't matter how big, how many variables, or how many or how big anything is there is no way you are going to get a Too Many Line Continuations error without having too many continuations. Somewhere in your code you actually do have too many continuations or the compiler thinks you do for some reason. Any missing statement or out of place statement somewhere could cause the compiler to go off on a wild rampage and perhaps issue error messages that may or may not actually be the error in question.
Is it ok that I cry now?...
Only if you are a cry baby
It has not happened to me in a very long time but there is the rare occasion when a file is not saved correctly for some reason. I think somehow a unicode (or what vb wants to try and read as unicode) character gets in there and this sends vb into a hissy fit (Chr(0)?). Or another possibility is that the file is being written across a bad sector, hence the bad characters that makes vb go off the deep end (not once but twice!).
And BTW, did you realize you contradicted yourself?
I looked through all my code and I couldn't find any areas where I have used too many continuations (if you mean the underscore_, I haven't used it once in my whole project) and I can't find any areas where I might be missing a statement or anything out of the ordinary.
Now the only part I can't check is the part of code that won't show cause of this error.
This is exactly what the error message says:
"An error occurred while background loading module 'frmPlayerScore'. Background load will now abourt and the code for some modules may not be loaded. Saving these modules to their current file name will result in code loss. Please load a new project."
Does that sound like a compile error and the thing is just getting confused?
I really think your best bet for getting this sorted is to post the project. If you just include the *.mod, *.cls, *.frm files and Zip it should not be that big.
The squares you describe suggest corruption of some sort. I'm afraid it might well be impossible to get all the original code back, but if you post it people here will certainly give it a go.
From what code you have shown I get the impression that your project could be restructured in a much shorter, simpler way. Again if you post the project we would be better placed to help you there also.
Last edited by Milk; Mar 10th, 2009 at 12:28 PM.
Reason: gramma or lack of
And BTW, did you realize you contradicted yourself?
Probably but I think I will forgive myself.
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
just the select case from the player name to the next select is 2940 bytes * 357 = 1049580 / 1024 = 1024.980 which is double the allowed 64kb in a single proceedure so even if you do get it to display correctly within VB, you will never get it to run.
Ya gotta break it up capt'n, she can't take ana more a this!
If all that code is in one sub then it is to large for vb's limit of 64k
Yeah I mentioned that earlier MartinLiss, all the other forms are fine. That is why I believe that it may not be a continuation error but rather the compiler is acting up as stated eariler by jmsrickland.
The code is defiantly lost (~750 KB of null chars)
Before you get too busy Dan do you want us to suggest ways of coding this without the the need for the ENORMOUS select cases everywhere? It looks like you have hard coded all the team players. There are easier and much shorter ways to code this.
You could have just cut out the bad section of code and re-pasted it but I guess all's well that ends well. And now that we've helped you, you can help us by pulling down the Thread Tools menu and selecting the Mark Thread Resolved item which will let everyone know that you have your answer. (You will need to have JavaScript enabled.) Also if someone has been particularly helpful (and there's no need to do it for me) you have the ability to affect a their forum "reputation" by rating their post. Only those ratings that you give after you have 20 posts will actually count, but in all cases the person you rate will see it and know that you appreciate their help.
I was wondering if the fact that only one Form could not be loaded might be because VB could not locate it. Just a guess. Sometimes when I move a project from one location to another one or more files are no longer where VB thinks they should be. Of course, VB will issue a message box telling you this but who knows what people see and don't see. I'm sure this is not the case. Not a biggie here.
Last edited by jmsrickland; Mar 10th, 2009 at 05:53 PM.
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.