Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Windows CE Bind HashTable to DataGrid

Posted on 2006-06-05
9
Medium Priority
?
533 Views
Last Modified: 2012-06-27
In windows ce or pocket pc, how i can i bind an HasTable to a DataGrid?

I've tried this but with no resuts...i keep getting an Argument Exception Error...

try
{
  dataGrid1.DataSource = orderItems;//orderItems is the HashTable
  dataGrid1.Refresh();
}
catch(Exception ex){MessageBox.Show(ex.Message);}


...Please Help!
0
Comment
Question by:xjpmauricio
  • 5
  • 4
9 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16832382
You can't bind a Hashtable to a DataGrid, since Hashtable doesn't implement a supportable interface.  You will have to choose a different structure.

Bob
0
 
LVL 1

Author Comment

by:xjpmauricio
ID: 16832534
What abou if i try to Bind two Arrays to a DataGrid in two different columns of the same DataGrid?

ArrayList deliverDocBoxArr = new ArrayList();
ArrayList collectDocBoxArr = new ArrayList();

How can i do it?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16832589
Nope, no can do.

What is wrong with a DataTable?  It has the structure designed for data-binding.

Bob
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Author Comment

by:xjpmauricio
ID: 16832613
ok. But how do i add items to a DataTable with two columns and then how do i Bind them to the datagrid?
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 1260 total points
ID: 16832640
Here is an example of creating an in-memory DataTable, that you can bind to the DataGrid:

DataTable table = new DataTable();

table.Columns.Add("Delivery", typeof(DateTime));
table.Columns.Add("Collect", typeof(bool));

DataRow row = table.NewRow();
row["Delivery"] = DateTime.Now;
row["Collect"] = true;
table.Rows.Add(row);

Bob
0
 
LVL 1

Author Comment

by:xjpmauricio
ID: 16832685
now how do i bind it to the datagrid?
0
 
LVL 1

Author Comment

by:xjpmauricio
ID: 16832727
ok i know how to bind it....can u tell me how do i set the width for each column!?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16833400
DataGrid table style, column style, width property

Bob
0
 
LVL 1

Author Comment

by:xjpmauricio
ID: 16833409
i got it........tnx a lot for the datatable part!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Screencast - Getting to Know the Pipeline

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question