Error Beginning Not Declared....

Questions regarding syntax

Error Beginning Not Declared....

Postby tseyfarth » Mon Aug 09, 2010 12:46 am

Hello all!

I've finally got most all of the changes made to allow KB to compile. Down to what I think is the last one.

KB created a new file (dunno where it is exactly since it does not appear in the project explorer) called "default2.kbasic. It added lines of code as follows:

Code: Select all
' --- Begin: Inserted by KBasic Atelier automatically  ---


frmMain = New frmMain
frmMain.Open()

Application.Run()


' --- End: Inserted by KBasic Atelier automatically  ---




The compiler complains "parser error: Beginning not declared in SUB/FUNCTION or GLOBAL Line 13....

Line 13 is the line below the code "' --- End: Inserted by KBasic Atelier automatically ---"

What is this? I could not find any reference to how to create the starting points for apps. The original VB6 code, was an ActiveX.EXE application. It would be nice if this one was the same way, but for the moment, just to get it to compile/create and exe would be fine! It does have a form (the original did not show the form but this one should).

Anyway, the original called this on start up:
Code: Select all

option oldbasic
Option Explicit on

Public Sub Main()
   frmMain.MSComm1.InBufferSize = 1024
   frmMain.MSComm1.RTSEnable = True
    Remotes.TotalRemotes = 0
    SndString.TotalCommands = 0
   ' SndString.Cmd = False
    SndString.Sent = True
    ReDim SingleDrStatus(0)
End Sub



For KB, the references to MSCOMM1 have been remarked throughout.

Can anyone explain and/or point me to explanation/documentation for app start up - and what this error means?

Thank you!
Tim
tseyfarth
 
Posts: 101
Joined: Mon Aug 02, 2010 10:11 am

Re: Error Beginning Not Declared....

Postby Henning » Mon Aug 09, 2010 12:40 pm

Wild guess...

In Project/Properties, The startup Form Name wrong.

Your AX started with Sub Main() in a module, Kb will start with Private Sub Form_OnOpen() in the frmMain code.

Also, remove the option oldbasic line.
Not sure about Option Explicit On...

/Henning
Henning
 
Posts: 262
Joined: Mon Feb 09, 2009 12:03 am
Location: Sweden

Re: Error Beginning Not Declared....

Postby pappawinni » Mon Aug 09, 2010 5:34 pm

The default "Option KBasic" does not support "Option Explicit"
(it works as if Option Explicit is switched on anyway)

Therefore if "Option Oldbasic" is removed then
"Option Explicit on" should also be removed.
Pappa makes everything what otherwise none likes :)
pappawinni
 
Posts: 192
Joined: Tue Jan 19, 2010 11:27 pm
Location: Germany

Re: Error Beginning Not Declared....

Postby tseyfarth » Mon Aug 09, 2010 5:44 pm

Hello pappawinni

I do not use option kbasic anywhere. only option oldbasic and option explicit on

Tim
tseyfarth
 
Posts: 101
Joined: Mon Aug 02, 2010 10:11 am

Re: Error Beginning Not Declared....

Postby tseyfarth » Mon Aug 09, 2010 6:00 pm

None of these seemed to have helped at all. KB is still failing at the same place - not on frmMain OnOpen().


On conversion, KB changed the form load to form onOpen() as follows:


Code: Select all
Private Sub Form_OnOpen/*Form_Load*/()
                                                                          '<--------***  I added this code after reading the first post on this today - but it did not help   
  frmMain = New frmMain
  Application.Run()

  Me.Visible = True
End Sub



I still get the same error. Even after remarking the code in the default2.kbasic, which KB created before, KB recreated default2.Kbasic again and added its own code. Then errors on line 13 once again.


So to be clear, the project properties are set as:
Main form name = frmMain
Project Type "manually"
Login form = blank

Form OnOpen() code =

Code: Select all
Private Sub Form_OnOpen/*Form_Load*/()
   
  frmMain = New frmMain
  Application.Run()

  Me.Visible = True
End Sub


KB Compiler adds a new file called "default2.KBasic with the following code;

Code: Select all


' --- Begin: Inserted by KBasic Atelier automatically  ---


frmMain = New frmMain
frmMain.Open()

Application.Run()


' --- End: Inserted by KBasic Atelier automatically  ---


The compiler still fails with the same message on the line following '--- End:....
Any other ideas?

Thank you
Tim
tseyfarth
 
Posts: 101
Joined: Mon Aug 02, 2010 10:11 am

Re: Error Beginning Not Declared....

Postby Henning » Mon Aug 09, 2010 6:02 pm

Option KBasic is the default when no other Option something is declared.

Form_OnOpen()
Remove theese lines:
frmMain = New frmMain
Application.Run()

Then either call your Sub Main for initializing, or move that code here.

/Henning
Henning
 
Posts: 262
Joined: Mon Feb 09, 2009 12:03 am
Location: Sweden

Re: Error Beginning Not Declared....

Postby tseyfarth » Mon Aug 09, 2010 6:36 pm

I will try that again. The funny thing is, I have no idea where this code module resides. It is not listed in the project explorer anywhere and was created by KB. Last time I remarked out that code, KB removed the remarks. So this is not me creating it.

The only way to find/access it, is by compiling (I just restarted the computer to physically move to another building).

Tim
tseyfarth
 
Posts: 101
Joined: Mon Aug 02, 2010 10:11 am

Re: Error Beginning Not Declared....

Postby tseyfarth » Mon Aug 09, 2010 6:53 pm

I remarked out the code from the form onOpen()

Code: Select all
Private Sub Form_OnOpen/*Form_Load*/()
'   
'  frmMain = New frmMain
'  Application.Run()
'
'  Me.Visible = True
End Sub



And delete the code in the default2.KBasic_Module and the module itself AND cleared the cache AND restarted the IDE.


KB created the module again default2.kbasic with the following code - errors in the same place:
Code: Select all

' --- Begin: Inserted by KBasic Atelier automatically  ---


frmMain = New frmMain
frmMain.Open()

Application.Run()


' --- End: Inserted by KBasic Atelier automatically  ---


Form On Open() is unchanged (all code still remarked out inside).

Tim
tseyfarth
 
Posts: 101
Joined: Mon Aug 02, 2010 10:11 am

Re: Error Beginning Not Declared....

Postby Slowdown » Mon Aug 09, 2010 7:11 pm

Hi Tim,
Code: Select all
Private Sub Form_OnOpen/*Form_Load*/()

End Sub


Change the name of the sub in
Code: Select all
Private Sub Form_OnOpen()

End Sub


At this stage it's a wild guess to say what is really going wrong.
Code: Select all
' --- Begin: Inserted by KBasic Atelier automatically  ---


frmMain = New frmMain
frmMain.Open()

Application.Run()


' --- End: Inserted by KBasic Atelier automatically  ---

The above code is inserted by KBasic itself do not change or delete that file.
Regards
Slowdown for now i'm back
Slowdown
 
Posts: 347
Joined: Sat May 02, 2009 6:48 pm
Location: Netherlands

Re: Error Beginning Not Declared....

Postby tseyfarth » Mon Aug 09, 2010 7:18 pm

I've also tried changing the properties to SDI, I've tried adding my start up code to frmMain Form_OnOpen, calling my old starting code from within OnOpen and also tried with nothing in OnOpen.

In each case, KB creates a default2.KBasic module and adds its own code, then crashes on line 13....

Really really strange...

I just got your new post. Will try that too. I know KB does not like remarking on certain lines of Select Case (makes for harder reading for me) so why not here too! Will try and advise!

Tim
tseyfarth
 
Posts: 101
Joined: Mon Aug 02, 2010 10:11 am

Next

Return to Coding Questions

cron