|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Newb looking for data binding helpI'd like any suggestions on how I can get my data set (not a DataSet) bound to a couple of controls on a form. Let me start by describing what my data looks like. Each entry correlates to a piece of equipment and has the following information: Two strings, one for a system name and one for equipment name An integer An ArrayList (which will contain only strings) Each data entry has an associated TreeNode and is a child node to a 'system' node. Each node is in a hashtable which then points to the 'equipment's data set. When the user clicks on an 'equipment' node, I'd like to display just its data (the integer, and the array list). When a 'system' node is selected, I'd like to display all of the strings in the arraylists of that system, and a MIN function of that system's integers. I thought it would be awesome if I could store the entries in a dataTable (one row per piece of equipment), bind columns to Text and ListBoxes. Then when a user selects a node, I find it's system & equipment name (hashtable lookup to get a datarow), then simply change the datatable's rowFilter string to display only the selected piece of equipment or only the selected table's equipment. That all almost works great. However, the list boxes I am using call the ToString method of each arrayList instead of displaying each string within the arrayList. (so I get a list of 'System.ArrayList' entries). Does anyone have any workarounds, or suggestions as to better arrainging my datastructure (such as a custom class instead of a table, forget data binding, etc) Thanks in advance, Kevin Kevin,
The first thing that you need to bind are properties. Therefore a strongly typed generic list will probably be better. Cor <kevinwo***@gmail.com> schreef in bericht Show quoteHide quote news:1161362202.821203.7620@e3g2000cwe.googlegroups.com... > Hi all. > > I'd like any suggestions on how I can get my data set (not a DataSet) > bound to a couple of controls on a form. Let me start by describing > what my data looks like. Each entry correlates to a piece of equipment > and has the following information: > > Two strings, one for a system name and one for equipment name > An integer > An ArrayList (which will contain only strings) > > Each data entry has an associated TreeNode and is a child node to a > 'system' node. Each node is in a hashtable which then points to the > 'equipment's data set. > > When the user clicks on an 'equipment' node, I'd like to display just > its data (the integer, and the array list). When a 'system' node is > selected, I'd like to display all of the strings in the arraylists of > that system, and a MIN function of that system's integers. > > I thought it would be awesome if I could store the entries in a > dataTable (one row per piece of equipment), bind columns to Text and > ListBoxes. Then when a user selects a node, I find it's system & > equipment name (hashtable lookup to get a datarow), then simply change > the datatable's rowFilter string to display only the selected piece of > equipment or only the selected table's equipment. > > That all almost works great. However, the list boxes I am using call > the ToString method of each arrayList instead of displaying each string > within the arrayList. (so I get a list of 'System.ArrayList' entries). > > Does anyone have any workarounds, or suggestions as to better > arrainging my datastructure (such as a custom class instead of a table, > forget data binding, etc) > > Thanks in advance, > > Kevin > Thanks for the reply,
Are you suggesting that instead of storing my entries in a datatable, store them in a custom generic list, or rather, instead of using array lists to store the strings, using a generic list there? If its the later, wouldn't I have the same problem in that, I can't get the binding control to iterate for each string within the collections? Regards, Kevin Cor Ligthert [MVP] wrote: Show quoteHide quote > Kevin, > > The first thing that you need to bind are properties. > > Therefore a strongly typed generic list will probably be better. > > Cor > > <kevinwo***@gmail.com> schreef in bericht > news:1161362202.821203.7620@e3g2000cwe.googlegroups.com... > > Hi all. > > > > I'd like any suggestions on how I can get my data set (not a DataSet) > > bound to a couple of controls on a form. Let me start by describing > > what my data looks like. Each entry correlates to a piece of equipment > > and has the following information: > > > > Two strings, one for a system name and one for equipment name > > An integer > > An ArrayList (which will contain only strings) > > > > Each data entry has an associated TreeNode and is a child node to a > > 'system' node. Each node is in a hashtable which then points to the > > 'equipment's data set. > > > > When the user clicks on an 'equipment' node, I'd like to display just > > its data (the integer, and the array list). When a 'system' node is > > selected, I'd like to display all of the strings in the arraylists of > > that system, and a MIN function of that system's integers. > > > > I thought it would be awesome if I could store the entries in a > > dataTable (one row per piece of equipment), bind columns to Text and > > ListBoxes. Then when a user selects a node, I find it's system & > > equipment name (hashtable lookup to get a datarow), then simply change > > the datatable's rowFilter string to display only the selected piece of > > equipment or only the selected table's equipment. > > > > That all almost works great. However, the list boxes I am using call > > the ToString method of each arrayList instead of displaying each string > > within the arrayList. (so I get a list of 'System.ArrayList' entries). > > > > Does anyone have any workarounds, or suggestions as to better > > arrainging my datastructure (such as a custom class instead of a table, > > forget data binding, etc) > > > > Thanks in advance, > > > > Kevin > > Kevin,
Sorry I readed your message to quick, As I now read your message again and hope to understand it now well, is it probably better to use dataviews with your datatable. Than you can set the rowfilter of the dataview to the clicked part in the tree. A little bit like this, http://www.vb-tips.com/dbPages.aspx?ID=cb1408ff-030d-4ea8-80b1-af26354b1fa0 I hope this helps, Cor <kevinwo***@gmail.com> schreef in bericht Show quoteHide quote news:1161366396.446490.8250@i3g2000cwc.googlegroups.com... > Thanks for the reply, > > Are you suggesting that instead of storing my entries in a datatable, > store them in a custom generic list, or rather, instead of using array > lists to store the strings, using a generic list there? If its the > later, wouldn't I have the same problem in that, I can't get the > binding control to iterate for each string within the collections? > > Regards, > > Kevin > > > Cor Ligthert [MVP] wrote: >> Kevin, >> >> The first thing that you need to bind are properties. >> >> Therefore a strongly typed generic list will probably be better. >> >> Cor >> >> <kevinwo***@gmail.com> schreef in bericht >> news:1161362202.821203.7620@e3g2000cwe.googlegroups.com... >> > Hi all. >> > >> > I'd like any suggestions on how I can get my data set (not a DataSet) >> > bound to a couple of controls on a form. Let me start by describing >> > what my data looks like. Each entry correlates to a piece of equipment >> > and has the following information: >> > >> > Two strings, one for a system name and one for equipment name >> > An integer >> > An ArrayList (which will contain only strings) >> > >> > Each data entry has an associated TreeNode and is a child node to a >> > 'system' node. Each node is in a hashtable which then points to the >> > 'equipment's data set. >> > >> > When the user clicks on an 'equipment' node, I'd like to display just >> > its data (the integer, and the array list). When a 'system' node is >> > selected, I'd like to display all of the strings in the arraylists of >> > that system, and a MIN function of that system's integers. >> > >> > I thought it would be awesome if I could store the entries in a >> > dataTable (one row per piece of equipment), bind columns to Text and >> > ListBoxes. Then when a user selects a node, I find it's system & >> > equipment name (hashtable lookup to get a datarow), then simply change >> > the datatable's rowFilter string to display only the selected piece of >> > equipment or only the selected table's equipment. >> > >> > That all almost works great. However, the list boxes I am using call >> > the ToString method of each arrayList instead of displaying each string >> > within the arrayList. (so I get a list of 'System.ArrayList' entries). >> > >> > Does anyone have any workarounds, or suggestions as to better >> > arrainging my datastructure (such as a custom class instead of a table, >> > forget data binding, etc) >> > >> > Thanks in advance, >> > >> > Kevin >> > > |
|||||||||||||||||||||||