Page 1 of 2 12 LastLast
Results 1 to 40 of 47

Thread: [RESOLVED] Too Many Line Continuations

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Location
    Troon, Scotland
    Posts
    20

    Resolved [RESOLVED] Too Many Line Continuations

    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?

    Any help appreciated!

  2. #2
    Frenzied Member
    Join Date
    Mar 2009
    Posts
    1,182

    Re: Too Many Line Continuations

    If you have not overwritted the file yet, you can use notepad to open the file.

    Then look for lines that end with the underscore character _

    Place your cursor just prior to that character and hit delete twice.

    Save, repeat as necessary until file opens with VB

    Good Luck

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Location
    Troon, Scotland
    Posts
    20

    Re: Too Many Line Continuations

    Ok thanks man, I'll give it a try

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Location
    Troon, Scotland
    Posts
    20

    Re: Too Many Line Continuations

    It didn't work. When I opened it in notepad I got the same amount of code as I was getting in Visual Basic.

    Here is an example of my 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

    It displays details for each player (the snippet of code is repeated 357 times in my program for each player). It doesn't have any "_".

    Any ideas?

  5. #5
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Too Many Line Continuations

    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.

  6. #6
    Frenzied Member
    Join Date
    Mar 2009
    Posts
    1,182

    Re: Too Many Line Continuations

    Project Limitations


    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.

    Good Luck

  7. #7
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    Re: Too Many Line Continuations

    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.
    Last edited by Milk; Mar 10th, 2009 at 08:38 AM.

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Location
    Troon, Scotland
    Posts
    20

    Re: Too Many Line Continuations

    Nah sorry I can't post the project, its too big!

    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?
    Attached Files Attached Files
    Last edited by Dan_Dan_Man; Mar 10th, 2009 at 10:25 AM.

  9. #9
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Too Many Line Continuations

    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.

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Location
    Troon, Scotland
    Posts
    20

    Re: Too Many Line Continuations

    Yeah I did, it was never a problem. It was only cause I missed a bit out when I pasted my code snippet the first time.

  11. #11
    Frenzied Member
    Join Date
    Mar 2009
    Posts
    1,182

    Re: Too Many Line Continuations

    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...

    3570 - (3570 * .01) = 3534 * 16 = 56544 / 1024 = 543.692Kb
    36 * 22 = 792b

    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

    Me thinks you need a major redesign thought.

    Good Luck

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Location
    Troon, Scotland
    Posts
    20

    Re: Too Many Line Continuations

    Interesting new development!

    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?

  13. #13

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Location
    Troon, Scotland
    Posts
    20

    Re: Too Many Line Continuations

    I have A LOT of variables declared in a module.

    Most of the variables are integers and booleans and only one declared as variant

    Does this help?
    Attached Files Attached Files

  14. #14

  15. #15
    Frenzied Member
    Join Date
    Mar 2009
    Posts
    1,182

    Re: Too Many Line Continuations

    Quote Originally Posted by Dan_Dan_Man
    Interesting new development!

    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.

  16. #16
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    Re: Too Many Line Continuations

    I don't think we can help that much without seeing the project. We only really need to see the *.mod, *.frm, *.cls files.

    By the way Module1 declares LOTs of variants, please see this FAQ

    Edit: Go with vb5prgrmr
    Last edited by Milk; Mar 10th, 2009 at 11:36 AM.

  17. #17
    Frenzied Member
    Join Date
    Mar 2009
    Posts
    1,182

    Re: Too Many Line Continuations

    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!

  18. #18

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Location
    Troon, Scotland
    Posts
    20

    Re: Too Many Line Continuations

    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.

    Is it ok that I cry now?...

  19. #19
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Too Many Line Continuations

    Dan,

    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.

  20. #20
    Frenzied Member
    Join Date
    Mar 2009
    Posts
    1,182

    Re: Too Many Line Continuations

    Quote Originally Posted by jmsrickland
    Dan,

    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?

  21. #21

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Location
    Troon, Scotland
    Posts
    20

    Re: Too Many Line Continuations

    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?

  22. #22
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    Re: Too Many Line Continuations

    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

  23. #23
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Too Many Line Continuations

    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.

  24. #24

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Location
    Troon, Scotland
    Posts
    20

    Re: Too Many Line Continuations

    Right Milk I'll try and size it down as much as possible.

  25. #25

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Location
    Troon, Scotland
    Posts
    20

    Re: Too Many Line Continuations

    Right here it is.

    It won't work without all the picture files but you should have all the code there except the code that is not showing up.
    Attached Files Attached Files

  26. #26
    Frenzied Member
    Join Date
    Mar 2009
    Posts
    1,182

    Re: Too Many Line Continuations

    As I previously said...

    Quote Originally Posted by vb5prgrmr
    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

  27. #27

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Location
    Troon, Scotland
    Posts
    20

    Re: Too Many Line Continuations

    Yes but it worked before. The only thing I have changed is that I removed code.

  28. #28

  29. #29

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Location
    Troon, Scotland
    Posts
    20

    Re: Too Many Line Continuations

    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.

  30. #30

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Location
    Troon, Scotland
    Posts
    20

    Re: Too Many Line Continuations

    I'm gonna try re-typing the code that has been cut out. I'll let you all know how it goes.

    In the mean time, thanks for all your help!


  31. #31
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,427

    Re: Too Many Line Continuations

    Okay, cut the following lines and repaste them to fix the problem.

    Code:
            Case Is = "C.Landry"
                frmPlayerScore.Caption = "Carl Landry"
                PicPlayer.Picture = LoadPicture(App.Path & "\Landry.jpg")
                lblPlayerName.Caption = "Carl Landry"
                lblPlayerPrice.Caption = "$6.2M"
                lblPlayerPosition.Caption = "

  32. #32
    Frenzied Member
    Join Date
    Mar 2009
    Posts
    1,182

    Re: Too Many Line Continuations

    Quote Originally Posted by Dan_Dan_Man
    Right here it is.

    It won't work without all the picture files but you should have all the code there except the code that is not showing up.
    Okay, I have your form fixed so you can open your project without an error but you lost a bunch of code.
    Attached Files Attached Files

  33. #33
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    Re: Too Many Line Continuations

    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.

  34. #34

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Location
    Troon, Scotland
    Posts
    20

    Re: Too Many Line Continuations

    Yeah ok, is there a chance that if I retype the code exactly the way it was before this will happen again?

  35. #35

  36. #36

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Location
    Troon, Scotland
    Posts
    20

    Re: Too Many Line Continuations

    Yeah that's what I'm doing thanks

  37. #37

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Location
    Troon, Scotland
    Posts
    20

    Re: Too Many Line Continuations

    I just finished re-typing all my code and it seems to work fine just now without that error. Must have just been a weird bug.

    Thanks for all your time and help!


  38. #38
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,427

    Re: Too Many Line Continuations

    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.

  39. #39

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Location
    Troon, Scotland
    Posts
    20

    Re: Too Many Line Continuations

    Ok I will do that thanks

  40. #40
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [RESOLVED] Too Many Line Continuations

    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.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width