Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with XML documents and loops?
#6
Well that should be a simple problem to solve. If you used the code above without changing anything then the new buttons have no text or image and that's why you cannot see them but they are there just hover with the mouse over the toolstrip and you will see

To solve this just add another atribute to the xml file like this
Code:
<item name="btn" url="some Url" text="buton text">

Then set the value for the buton's text property inside the for loop
[code2=vbnet]For Each node In xml_doc.selectnodes("/root/ToolStrpButtons/item") 'the path of the xml child node
Dim btn As New ToolStripButton _
With {.Name = node.Attributes("name").Value.ToString, _
.Tag = node.Attributes("url").Value.ToString, _
.text = node.Attributes("text").Value.ToString}
AddHandler Button.Click, AddressOf TSButtonClick
Next[/code2]

Now the butons should be visible
Sssssssssoftware developer...


Messages In This Thread
Help with XML documents and loops? - by Derek275 - 11-06-2012, 05:11 AM
Re: Help with XML documents and loops? - by Snake_eyes - 11-11-2012, 09:40 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)