Archive

Archive for September, 2006

DataGrid: Selecting a single row from a cell

September 11th, 2006 rupert Comments off

This would select the whole row after selecting the cell

private void dataGrid1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
    DataGrid.HitTestInfo hti = dataGrid1.HitTest(e.X, e.Y);
    if (hti.Type == DataGrid.HitTestType.Cell)
    {
        dataGrid1.CurrentCell = new DataGridCell(hti.Row, hti.Column);
        dataGrid1.Select(hti.Row);
        POI temp = arrayListPOI[dataGrid1.CurrentRowIndex] as POI;
        FormPOI f = new FormPOI(temp);
        f.ShowDialog();
        //MessageBox.Show("RowIndex is: " + dataGrid1.CurrentRowIndex + " POIID: " + temp.poi_id);
    }
}
Categories: pocketpc Tags:

Binding an ArrayList to a DataGrid

September 7th, 2006 rupert Comments off

I need to populate a DataGrid from a CSV or FlatFile. I stumbbled upon George Sheperd’s Blog in binding an arraylist to a DataGrid instead.

       public void CreateArrayList(Building[] res)
        {
            arrayList = new ArrayList();
 
            foreach (Building mybldg in res)
            {
                arrayList.Add(mybldg);
            }
        }
 
        public void BindArrayListToDataGrid()
        {
            dataGrid.DataSource = arrayList;
 
            //create a custom tablestyle and add five columnstyles
            DataGridTableStyle ts = new DataGridTableStyle();
            ts.MappingName = "ArrayList";
 
            AddTextBoxColumnToGrid(ts, "bldg_id", "id", 50);
            AddTextBoxColumnToGrid(ts, "CN_bldg_name", "Name (CN)", 50);
            AddTextBoxColumnToGrid(ts, "EN_bldg_name", "Name (EN)", 50);
            AddTextBoxColumnToGrid(ts, "CN_address", "Address (EN)", 50);
            AddTextBoxColumnToGrid(ts, "EN_address", "Address (CN)", 50);
 
            dataGrid.TableStyles.Clear();
            dataGrid.TableStyles.Add(ts);
        }
 
        private void AddTextBoxColumnToGrid(DataGridTableStyle tableStyle,
                                        String strMappingName,
                                        String strHeaderText,
                                        int width)
        {
            DataGridTextBoxColumn cs = new DataGridTextBoxColumn();
            cs.MappingName = strMappingName; //public property name
            cs.HeaderText = strHeaderText;
            cs.Width = width;
            tableStyle.GridColumnStyles.Add(cs);
        }
Categories: pocketpc Tags:

.NET File IO Library

September 7th, 2006 rupert Comments off

FileHelpers library from  www.filehelpers.com could help in reading and writing to files, streams or even as a DataTable for your .NET Applications. I am currently using this library for a Simple Pocket PC Data Viewer which I called iVIEWPPCViewer. The iVIEWPPCViewer contains  DataGrid which could be populated from the FileHelpersEngine.

Categories: pocketpc Tags:

PocketPC eHowto’s

September 5th, 2006 rupert Comments off

You can start with Mobile Application Development eHow-tos and Tutorials from the M$ site.

“Creating a Windows Mobile-based Pocket PC Application Using Microsoft Visual Studio 2005 (Level 100)
Neil Enns, Lead Program Manager in the Visual Studio for Devices group, demonstrates creating a Web Browser application in C# for the Pocket PC. Neil pays particular attention to the new controls and layout features in Visual Studio 2005. (9:38 minutes)”

Just don’t know how to save the video files for offline viewing..

Categories: pocketpc Tags: