By Rupert
Posts tagged windows mobile
Development Environtment Setup for Windows Mobile Dev
Aug 3rd
1. Install Visual Studio.
3. Download and Install Windows Mobile 2005 SDK.
4. Open Visual Studio.
How to transfer files to device.
1. Open Device Emulator Manager

2. Connect to the Device

3. Set up ActiveSync as DMA

4. Finished.

DataGrid: Selecting a single row from a cell
Sep 11th
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); } }
Binding an ArrayList to a DataGrid
Sep 7th
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); }
Comments