PC Review


Reply
Thread Tools Rate Thread

Using DataGridView to display records in a hash table

 
 
krigare
Guest
Posts: n/a
 
      30th Dec 2006
There maybe a better way of doing this but I am attempting to display a
list of objects and their respective properties using a datagridview.

The object class is straight forward with several public properties.

Public Class myObj
Friend mID As String
Friend mData1 As String
Friend mData2 As String
Public Sub New(ByVal ID, ByVal Data1, ByVal Data2)
Me.mID = ID
Me.mData1 = Data1
Me.mData2 = Data2
End Sub
Public Property ID() As String
Get
ID = mID
End Get
Set(ByVal value As String)
mID = value
End Set
End Property
Public Property Data1() As String
Get
Data1 = mData1
End Get
Set(ByVal value As String)
mData1 = value
End Set
End Property
Public Property Data2() As String
Get
Data2 = mData2
End Get
Set(ByVal value As String)
mData2 = value
End Set
End Property
End Class

I generate a multitude of these objects and store them in a hash table.

Dim myHashtbl As New Hashtable()
Some Loop
myHashtbl.Add( ID, New myObj(ID, Data1, Data2))
End Loop

After I have done all of that, I would like to display the objects that
I stored in the hash table, within a DataGridView control. Where each
property is a Column and each instance of the object is a row. I was
able to assign the Datasouce to myObj, and the DataGridView picked up
all of the properties as columns. But I am unsure as how to populate the
grid with every object. Hopefully, this makes sense.

Thanks in advance!
Chuck
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C# MD5 Hash Does Not Match Hash Generated From Java Ratfish Microsoft C# .NET 3 6th Jun 2011 07:03 AM
Comment on how to uniquely track your objects in C# / hash table /get hash code raylopez99 Microsoft C# .NET 25 11th Aug 2008 06:54 AM
Modify code using a hash table in comparing two text files richardkreidl@northwesternmutual.com Microsoft VB .NET 0 20th Aug 2005 11:41 PM
Hash table code - anyone ?! AlexT Microsoft Excel Programming 3 29th Dec 2004 09:30 PM
hash table search or collection search?? Umut Tezduyar Microsoft Dot NET Framework 1 26th Aug 2003 01:28 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:29 PM.