Edwin
Two ways to do this:
The quick/dirty and frankly not very good way is to use UniXML:
private DataSet ds;
private Boolean showDict(String fileName, UniSession sess,
DataGridView dg) {
UniXML xml = sess.CreateUniXML();
xml.GenerateXML("SORT DICT " + fileName);
ds = xml.GetDataSet();
dg.AutoGenerateColumns = true;
dg.DataSource = ds.Tables[0];
return true;
}
The better way is create a DictItem class to hold the dictionary elements,
e.g.
class DictItem{
private String _id = String.Empty;
private String _type = String.Empty;
private Int32 _fno = 0;
(etc)
public String Id{
get { return _id; }
set { _id = value; }
}
(etc)
}
You can then populate a List<DictItem> by reading each one from the
dictionary, and set that as the data source for the grid.
private List<DictItem> list = new List<DictItem>();
private Boolean showDict(String fileName, UniSession sess,
DataGridView dg){
UniFile dict = sess.CreateUniFile("DICT " + fileName);
UniSelectList sel = sess.CreateUniSelectList(0);
sel.Select(dict);
while (sel.LastRecordRead == false) {
String id = sel.Next();
if (String.IsNullOrEmpty(id) == false) {
UniDynArray dictRec = dict.Read(id);
DictItem item = new DictItem();
item.Id = id;
item.Type = dictRec.Extract(1).StringValue;
// etc
list.Add(item);
}
}
dg.DataSource = list;
return true;
}
Brian
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Edwin Maluleke
> Sent: 14 July 2009 10:48
> To: [email protected]
> Subject: [U2] list DICT uniObjects
>
> Hi,
>
> I am trying to read and list the dictionary of a file on a
> dataGrid vb.net express 2008. I am using the uniObjects
> framework/library. I just can't seem to find my way round it.
> Please help
>
> _______________________________________________
> U2-Users mailing list
> [email protected]
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users