Developing Pocket PC Applications using Visual Studio.NET 2003 - Working with a datagrid control on Pocket PC using Visual Studio.NET 2003
(Page 5 of 5 )
Life would not be complete without using a “datagrid” control in any .NET application. Now, let us implement a “datagrid” control even with a Pocket PC application.
Follow the steps to achieve the same:
- Delete all the controls you played in the previous section (available on the form).
- Add a new button (called “Fetch”) and a “datagrid” that fits the width of the form.
- Open your code window and copy the following code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim dr As DataRow
Dim dt As New DataTable
dt.Columns.Add("empno")
dt.Columns.Add("ename")
dt.Columns.Add("sal")
dt.Columns.Add("deptno")
dr = dt.NewRow
dr("empno") = 1001
dr("ename") = "Jag"
dr("sal") = 2500
dr("deptno") = 10
dt.Rows.Add(dr)
dr = dt.NewRow
dr("empno") = 1002
dr("ename") = "Win"
dr("sal") = 3500
dr("deptno") = 10
dt.Rows.Add(dr)
dr = dt.NewRow
dr("empno") = 1003
dr("ename") = "Dhan"
dr("sal") = 5000
dr("deptno") = 20
dt.Rows.Add(dr)
Me.DataGrid1.DataSource = dt
End Sub
- Press F5 to execute your application.
- After a few seconds, once emulator is loaded, press on the “Fetch” button.
- It should give you the output in the following figure (Fig8).

I developed the application using Microsoft Windows Server 2003 Standard Edition with Microsoft Visual Studio.NET 2003 Enterprise Architect and Pocket PC SDK 2003 (along with additional emulators downloaded). The entire solution for this article is freely available in the form of a downloadable zip file.
In my upcoming articles, I shall concentrate further on developing advanced Pocket PC applications. So, keep up with the website!
Any comments, suggestions, feedback, bugs, errors, enhancements are highly appreciated at jag_chat@yahoo.com
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |