By Gary Smith - Thursday, October 29, 2009
Utilizing the NTreelist, and binding (via your sample) to a microsoft access query, I am returning the date as a vbShortDate, however when displayed - the time (12:00:00) is added.... How can I format the date so it only shows as whats returned from the query? Thanks
|
By Angel Chorbadzhiev - Friday, October 30, 2009
Hi Gary, In this case you will have to subclass the NTreeListTableData class by the following way: Public Class MyNTreeListTableData Inherits NTreeListTableData Protected Overrides Function CreateSubItem(ByVal value As Object) As Nevron.UI.WinForm.Controls.NTreeListNodeSubItem Dim item As NTreeListNodeSubItem = MyBase.CreateSubItem(value) If value.GetType() Is GetType(DateTime) Then item = New NTreeListNodeStringSubItem() TryCast(item, NTreeListNodeStringSubItem).Text = CDate(value).ToShortDateString() End If Return item End Function End Class This way you will be able to manage the visual representation of the DateTime item. Regards, Angel.
|
By Gary Smith - Monday, November 2, 2009
Thanks Angel, I'll give this a try once I get the controls installed.... I upgraded a new machine to windows 7 and the controls install, but they are not available in studio 2008. Gary
|
By Angel Chorbadzhiev - Monday, November 2, 2009
Hi Gary, The problem might be because you are trying to install .NET Vision for VS2005. We have separate installations for VS2005 and VS2008. You can download the VS2008 version from our download page: http://nevron.com/Downloads.Download.aspx Regards, Angel.
|
By Gary Smith - Monday, November 2, 2009
I dont know how I missed that Angel. I'm downloading the 2008 version now... will update after I get it installed. Thanks!
|
By Angel Chorbadzhiev - Monday, November 2, 2009
Hi Gary, Both can work together. You can keep Nevron .NET Vision for VS2005 installed if you are going to use VS2005. Otherwise you can uninstall it. Regards, Angel.
|
By Gary Smith - Tuesday, November 3, 2009
Thanks Angel, but I dont even have vs2005...lol... Installing the 2008 version solved the problem. Thanks again... Gary
|
By Gary Smith - Monday, November 9, 2009
Hi Angel, Got all my other issues taken care of and now I'm dealing with the treelist again. MyNTreeListTableData I attempted to utilize this function you provided, but I have no idea how or where to use it. Can you explain? Is there any documentation on the Tree List? I couldnt find any.... But if you can explain how to utilize the formating sub class you provided I would be much appreciative! Thanks! Gary
|
By Angel Chorbadzhiev - Monday, November 9, 2009
Hi Gary, When you try to bind data to NTreeList you usually do the following: Dim data As NTreeListTableData = New NTreeListTableData()data.Table = myDataTable data.Bind(NTreeList1) Now instead of using NTreeListTableData use the class above (MyNTreeListTableData): Dim data As MyNTreeListTableData = New MyNTreeListTableData()data.Table = myDataTable data.Bind(NTreeList1) And because in MyNTreeListTableData the way DateTime type is displayed was overridden with the desired DateTime format, your DateTime values will be displayed in this format. Regards, Angel.
|
By Gary Smith - Tuesday, November 10, 2009
Perfect Angel... just as I needed... Thanks for the explanation, as usual - you guys are right there..! Appreciate it!
Gary
|
By Gary Smith - Tuesday, November 10, 2009
Angel, the display works perfectly, however - there is a glitch in the sorting of the dates. When the data comes in it is displayed as: 10/1/2009 8/5/2009 8/3/2009 8/1/2009 7/1/2009
If I press the header above the dates for sorting, The dates now look like: 10/1/2009 7/1/2009 8/1/2009 8/5/2009 8/3/2009
Where the first date is out of order, but the others are in correct order... wierd? Ideas?
|
By Gary Smith - Tuesday, November 10, 2009
Sheesh, I feel so stupid! Ok Angel, now that I have the list populated, looks great (minus the sorting order thing)... I can not find any documentation on methods of retrieving values. If someone double clicks or highlights an item, how do I know what line they selected, and how do I get a value out of one of the columns? (say I need the data in column3 of the selected line)...? Sorry but if I could find docs this probbably wouldnt be a big problem (I was using the windows listview but I want to utilize your controls where possible), but I cant read by class porperties etc to find methods. (I did check the demo, but nothing shows how to obtain the data when you select it...) Thanks once again!
|
By Gary Smith - Friday, November 13, 2009
This is still a problem (sorting)... any ideas?
|
By Angel Chorbadzhiev - Friday, November 13, 2009
Hi Gary, Sorry for the delayed responce. Regarding sorting, the problem is that now the dates are presented as strings and the are sorted as strings. To fix this you should create a new class that represent short formatted date item and also you should made small modifications of the class that you create earlier. The new class should looks like this: Public Class NTreeListNodeShortDateTimeSubItem Inherits NTreeListNodeDateTimeSubItem Public Overrides ReadOnly Property DisplayValue() As String Get Return CDate(Value).ToShortDateString() End Get End PropertyEnd Classand now MyNTreeListTableData should looks like the following: Public Class MyNTreeListTableData Inherits NTreeListTableData Protected Overrides Function CreateSubItem(ByVal value As Object) As Nevron.UI.WinForm.Controls.NTreeListNodeSubItem Dim item As NTreeListNodeSubItem = MyBase.CreateSubItem(value) If value.GetType() Is GetType(DateTime) Then item = New NTreeListNodeShortDateTimeSubItem() TryCast(item, NTreeListNodeShortDateTimeSubItem).Value = value End If Return item End FunctionEnd ClassThese changes should fix the sorting problem. Sorry that I didn't foresee it at the beginning. Regarding selection retrieving you should attach to ItemNotify event and check for the appropriate notify code. Again, here is an example: Private Sub NTreeList1_ItemNotify(ByVal sender As System.Object, ByVal data As NLightUIItemNotifyData) Handles NTreeList1.ItemNotify If data.NotifyCode = NTreeList.ItemLabelDoubleClickNotifyCode Then MessageBox.Show( TryCast(data.Sender, NTreeListNode).SubItems(0).RawData) End IfEnd SubThe drawback here is that you cannot determine on which column is clicked, so you have to know which columns data you want to retreve. At the example above this should be the first one (SubItems(0)). I hope this will helps. Along with the documentation you can check the example application provided in the instalation that shows how to use the most common functionality of our UI controls. Regards, Angel.
|
By Gary Smith - Monday, November 16, 2009
Thanks Angel, It works as designed and I appreciate your help! I'm learning and it is getting easier to understand the classes/controls. Appreciate the help! Gary
|
|