populate a list box - InfoPath Dev Sign in | Join | Help in Code InfoPath (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » InfoPath » Code » populate a list box populate a list box Last post 07-01-2008 07:37 AM by Hilary Stoupa. 1 replies. Page 1 of 1 (2 items) Sort Posts: Oldest to newest Newest to oldest Previous Next 07-01-2008 04:32 AM greenberet123 Joined on 06-28-2008 Posts 1 populate a list box Reply Contact Hi, ive read many articles about populating a list box through code and this is what ive got till now XPathNavigator DOM = this.MainDataSource.CreateNavigator(); XPathNavigator group1 = DOM.SelectSingleNode("/dfs:myFields/my:userlist"); XPathNavigator field1 = DOM.SelectSingleNode("/dfs:myFields/my:userlist/my:listname"); XPathNavigator newNode = field1.Clone(); newNode.SelectSingleNode("value").SetValue(thisXDocument.DOM.selectSingleNode("/dfs:myFields/my:unbound/my:textbox").text); newNode.SelectSingleNode("displayname").SetValue(thisXDocument.DOM.selectSingleNode("/dfs:myFields/my:unbound/my:textbox").text); group1.AppendChild(newNode); well, all this is okay but the first line gives me an error XPathNavigator DOM = this.MainDataSource.CreateNavigator(); the current object has no member called MainDataSource. please help. ps: ive made that group with a repeating element etc. its only this first line thats a problem 07-01-2008 07:37 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: populate a list box Mark as Not AnswerMark as Answer... Reply Contact Hi -- you don't need the "this" in your first line -- the syntax would be XPathNavigator DOM = MainDataSource.CreateNavigator(); Hilary Stoupa Page 1 of 1 (2 items) Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.
Hi,
ive read many articles about populating a list box through code and this is what ive got till now
XPathNavigator DOM = this.MainDataSource.CreateNavigator();
XPathNavigator group1 = DOM.SelectSingleNode("/dfs:myFields/my:userlist");
XPathNavigator field1 = DOM.SelectSingleNode("/dfs:myFields/my:userlist/my:listname");
XPathNavigator newNode = field1.Clone();
newNode.SelectSingleNode("value").SetValue(thisXDocument.DOM.selectSingleNode("/dfs:myFields/my:unbound/my:textbox").text);
newNode.SelectSingleNode("displayname").SetValue(thisXDocument.DOM.selectSingleNode("/dfs:myFields/my:unbound/my:textbox").text);
group1.AppendChild(newNode);
well, all this is okay but the first line gives me an error
the current object has no member called MainDataSource. please help.
ps: ive made that group with a repeating element etc. its only this first line thats a problem
Hi -- you don't need the "this" in your first line -- the syntax would be XPathNavigator DOM = MainDataSource.CreateNavigator();