[SOLVED] XmlDocument - unknown identifier error

New to Gambas? Post your questions here. No question is too silly or too simple.
Post Reply
ForeverNoob
Posts: 9
Joined: Thursday 1st October 2020 10:11am

[SOLVED] XmlDocument - unknown identifier error

Post by ForeverNoob »

Hello,

Sorry for the newbie question.

Started a project that reads xml files into a TreeView:

Code: Select all

Use "gb.xml"

Public Sub Form_Open()
  LoadProjectView(TreeView1, "path-to-xml-file")
End

Private Sub LoadProjectView(ProjectView As TreeView, ProjectFile As String)
  ProjectDoc = New XmlDocument    ' <-- Error here: Unknown identifier: XmlDocument

  ProjectDoc.Open(ProjectFile)

End
What am I missing?

TIA
Last edited by ForeverNoob on Wednesday 4th September 2024 12:34pm, edited 1 time in total.
User avatar
BruceSteers
Posts: 1755
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: XmlDocument - unknown identifier error

Post by BruceSteers »

You must add gb.xml to the project components using the project properties page in the IDE (Ctrl-I)

The "Use" keyword is intended only for making gbs3 script files and cannot be used in a normal project to load a component.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
thatbruce
Posts: 217
Joined: Saturday 4th September 2021 11:29pm

Re: XmlDocument - unknown identifier error

Post by thatbruce »

No such thing as
 "Use <component>"
in normal code, it's only for scripting.

Research how the project configuration works or "Component.Load"
User avatar
thatbruce
Posts: 217
Joined: Saturday 4th September 2021 11:29pm

Re: XmlDocument - unknown identifier error

Post by thatbruce »

Steers, you beat me by milliseconds! :shock:
ForeverNoob
Posts: 9
Joined: Thursday 1st October 2020 10:11am

Re: XmlDocument - unknown identifier error

Post by ForeverNoob »

BruceSteers wrote: Wednesday 4th September 2024 10:17am You must add gb.xml to the project components using the project properties page in the IDE (Ctrl-I)

The "Use" keyword is intended only for making gbs3 script files and cannot be used in a normal project to load a component.
Thanks for answering. Next dumb question: Which component should I use for XmlDocument? There's no "gb.xml" on the list.
ForeverNoob
Posts: 9
Joined: Thursday 1st October 2020 10:11am

Re: XmlDocument - unknown identifier error

Post by ForeverNoob »

ForeverNoob wrote: Wednesday 4th September 2024 10:56am
BruceSteers wrote: Wednesday 4th September 2024 10:17am You must add gb.xml to the project components using the project properties page in the IDE (Ctrl-I)

The "Use" keyword is intended only for making gbs3 script files and cannot be used in a normal project to load a component.
Thanks for answering. Next dumb question: Which component should I use for XmlDocument? There's no "gb.xml" on the list.
Found it. Had to install gambas-gb-xml from repos. Thanks for help.
User avatar
BruceSteers
Posts: 1755
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: [SOLVED] XmlDocument - unknown identifier error

Post by BruceSteers »

You're welcome.

And after a recent discussion on the M/L it turns our the "Use" keyword actually CAN be used in a normal project and acts just like Component.Load()

It's apparently been that way for 10 years but nobody updated the wiki lol :)
If at first you don't succeed , try doing something differently.
BruceS
Post Reply