Basic (no pun intended) Gambas Query

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

Basic (no pun intended) Gambas Query

Postby TonyBradley » Wed May 21, 2014 3:08 pm

I'm trying to build a GUI to access MySQL, as described on page 94 of issue 71, but am running into difficulties.

I enter the following code, and hit the run button as instucted...

PUBLIC SUB Form_Open()
combobox1.Add("Fred Jones")
combobox1.Add("Mary Smith")
combobox1.Add("Tony Bradley")
END

...only to get the following error message:
Unknown Identifier:combobox1 at line 6 in FMain.class

What am I doing wrong?
TonyBradley
 
Posts: 22
Joined: Thu Jul 13, 2006 1:40 pm
Location: Plymouth

Postby roseway » Wed May 21, 2014 5:45 pm

I don't know anything about Gambas, but presumably you first have to drop a combobox on the form before writing code which refers to it.
Eric
roseway
LXF regular
 
Posts: 450
Joined: Thu Jan 18, 2007 2:27 pm

Postby Ram » Thu May 22, 2014 1:49 am

Hi,

I've just installed Gambas3 and created a new graphical project.

Dropped a textbox & combox on the form. Checked it ran ok.

Double clicked the form to show the source code and added the text from the tutorial.

This is what I have
Code: Select all
' Gambas class file

Public Sub _new()

End

Public Sub Form_Open()
        combobox1.Add("Fred Jones")
        combobox1.Add("Mary Smith")
        combobox1.Add("Tony Bradley")
End


Which runs and displays the names once the combobox down arrow is clicked.

lubuntu LXDE 13.10 running on AMD Phenom II*4; ASUS Crosshair III Formula MB; 4 GB Ram.....
User avatar
Ram
LXF regular
 
Posts: 1684
Joined: Thu Apr 07, 2005 9:44 pm
Location: Guisborough


Return to Programming

Who is online

Users browsing this forum: Google [Bot] and 1 guest