Newbie getting started problems - syntax error line 1 pos 1

Questions regarding IDE/Code-Editor

Newbie getting started problems - syntax error line 1 pos 1

Postby ziplock » Tue Feb 08, 2011 10:50 am

Hi

I'm a newbie in the process of learning BASIC as a first step into hobby programming.

I want to start off by doing old school line by line programming to get the hang and learning by running my code to see what happens. Basic stuff. However, I'm having trouble getting KB to "work". I don't seem to be able to get around the way the IDE works, meaning when I type Print "Hello World" in a New Project/Form1 it gives me a "syntax error in line 1 near pos 1".

My question is - how do I set up and operate the IDE so that I can type code and press run to see the results? Where should I be entering my code?

In a nutshell I'm trying to use KB as a "monitor" where I type code and the monitor spits out the result.

Thanks for the help
ziplock
 
Posts: 2
Joined: Tue Feb 08, 2011 9:53 am

Re: Newbie getting started problems - syntax error line 1 pos 1

Postby pappawinni » Tue Feb 08, 2011 3:27 pm

Hi ziplock,

for a simple program you just open a new FILE and save this.
Then you can just code
? "Hello"
and run the file.

In a project u normally have a form object and there you code for events of that object.
In the poperty window for the form you could scroll down to create a coding section [...] for the
OnOpen
event.

It is also possible not to use a form. Then you need to configure the project properties so that
the function main() is called on program startup.
And in the coding section there must of course exit the function main().

It could perhaps make sense to open some of the examples and play with that.
Pappa makes everything what otherwise none likes :)
pappawinni
 
Posts: 192
Joined: Tue Jan 19, 2010 11:27 pm
Location: Germany

Re: Newbie getting started problems - syntax error line 1 pos 1

Postby ziplock » Tue Feb 08, 2011 4:31 pm

pappawinni wrote:Hi ziplock,

for a simple program you just open a new FILE and save this.
Then you can just code
? "Hello"
and run the file.

In a project u normally have a form object and there you code for events of that object.
In the poperty window for the form you could scroll down to create a coding section [...] for the
OnOpen
event.

It is also possible not to use a form. Then you need to configure the project properties so that
the function main() is called on program startup.
And in the coding section there must of course exit the function main().

It could perhaps make sense to open some of the examples and play with that.


Thanks pappawinni for the answer. It sure worked using a plain form and not a project! Now I guess I'll just have to learn using form objects and main() function. One step at a time. Thx
ziplock
 
Posts: 2
Joined: Tue Feb 08, 2011 9:53 am

Re: Newbie getting started problems - syntax error line 1 pos 1

Postby Slowdown » Wed Mar 09, 2011 8:22 pm

Your first project,
create a new project by,
Schermafbeelding 2011-03-09 om 21.03.28.png
Schermafbeelding 2011-03-09 om 21.03.28.png (77.08 KiB) Viewed 1100 times


Than choose a name for your project,
Schermafbeelding 2011-03-09 om 21.04.09.png
Schermafbeelding 2011-03-09 om 21.04.09.png (38.33 KiB) Viewed 1096 times


Go to your form designer,
Schermafbeelding 2011-03-09 om 21.02.52.png
Schermafbeelding 2011-03-09 om 21.02.52.png (42.78 KiB) Viewed 1097 times

click on OnOpen by Event (CONTROL)
This what you see after clicking,
Code: Select all
Private Sub Form_OnOpen()
 
End Sub

Then you type between Private Sub Form_OnOpen() and End Sub,
Print "hello world"
Then you have this,
Code: Select all
Private Sub Form_OnOpen()
  print "hello world"
End Sub

Hit F5 and voila your first project will run ;)
Regards
Slowdown for now i'm back
Slowdown
 
Posts: 347
Joined: Sat May 02, 2009 6:48 pm
Location: Netherlands


Return to IDE

cron