{"id":6093,"date":"2007-05-14T14:46:00","date_gmt":"2007-05-14T14:46:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vbteam\/2007\/05\/14\/visual-basic-smart-devices-matt-gertz\/"},"modified":"2024-07-05T14:46:36","modified_gmt":"2024-07-05T21:46:36","slug":"visual-basic-smart-devices-matt-gertz","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/vbteam\/visual-basic-smart-devices-matt-gertz\/","title":{"rendered":"Visual Basic &#038; Smart Devices (Matt Gertz)"},"content":{"rendered":"<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">Last week I talked a bit about operator overloading, and used the concept to support a library of matrix functions.<span>&nbsp; <\/span>This week, we\u2019ll use those functions in a Smart Device application to create a matrix calculator.<\/font><\/p>\n<h2><font face=\"Cambria\" color=\"#4f81bd\" size=\"4\">Smart Device applications<\/font><\/h2>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">It\u2019s extremely easy to create an application for your Smart Device.<span>&nbsp; <\/span>Let\u2019s start from the solution we created last week.<span>&nbsp; <\/span>Assuming that solution is loaded, choose \u201cFile,\u201d \u201cAdd,\u201d \u201cNew Project\u2026\u201d and then in the resulting dialog, expand the \u201cSmart Device\u201d node under the Visual Basic node.<span>&nbsp; <\/span>You\u2019ll find 3 child nodes \u2013 one for Pocket PC 2003, one for Smartphone 2003, and one for Windows CE 5.0.<span>&nbsp; <\/span>For the work I\u2019ll be doing today, the choice actually matters little, and mostly just affects the default size of the window and the colors in the form \u2013 I\u2019ll be sticking to basic controls and so everything I\u2019ll be doing will be common to all of the SD platforms.<span>&nbsp;&nbsp; <\/span>(Note that this is not always the case \u2013 there are device-specific differences.)<span>&nbsp; <\/span>I arbitrarily chose \u201cWindows CE 5.0\u201d and then selected \u201cDevice Application,\u201d giving the application the name \u201cMatrixMath.\u201d<\/font><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">After you press \u201cOK,\u201d you\u2019ll get a form designer, just like with a normal Windows application.<span>&nbsp; <\/span>By default, the form is sized for a WebPad, so the first thing I do is change the size to 240 x 320, which will work nicely for most devices on the market (except, alas, for my new Treo, which has a square 240 x 240 screen \u2013 but it should at least scroll automatically on that).<span>&nbsp; The only reason I&#8217;m changing the size is to give me an idea as to how the layout will look on that size screen, which is the most common size&nbsp;&#8212; as Daniel Moth reminded me, generally speaking &#8220;full screen&#8221; will always be an appropriate setting.&nbsp; <\/span>I change the title bar text to be \u201cMatrixMath\u201d and set Menu to \u201cnone\u201d \u2013 we won\u2019t be doing menus today, but if you decide to design menus, it\u2019s essentially the same as designing menus in Windows applications, which I touched on briefly in my earlier series on Euchre.<\/font><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">Now, I\u2019ll create a layout for my form.<span>&nbsp; <\/span>I\u2019ve decided to go with a 4&#215;4 matrix, since that\u2019s the most useful one when doing robotics (and for smaller square matrices, you can still make the various functions work as they normally would \u2013 just set the elements in the extra columns and rows to 0 except for the diagonals, which should be set to 1).<span>&nbsp; <\/span>I\u2019ll add the appropriate number of text boxes to the form to account for the elements, and give them the names \u201cM00,\u201d \u201cM01,\u201d etc.<span>&nbsp; <\/span>I\u2019ll also add a label &amp; text box (set to read-only in the properties) to display the determinant \u2013 in my calculator, this value will be updated automatically when the matrix changes.<span>&nbsp; <\/span>Finally, I\u2019ll add buttons for the following:<span>&nbsp; <\/span>Inverse, Transpose, Scale, +, -, *, =, CE (clear entry), and AC accumulator clear).<span>&nbsp; <\/span>The resulting form is shown in \u201cMatrixMath-form.jpg\u201d attached in the ZIP file.<\/font><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">Now, I have to start hooking up the various events.<span>&nbsp; <\/span>First, though, I\u2019ll need to reference the class library we created last week.<span>&nbsp; <\/span>However, SD applications can\u2019t use \u201cnormal\u201d class libraries (which target the .NET 2.0 framework), so once again I choose \u201cAdd New Project,\u201d navigate to the Windows CE 5.0 node, and select \u201cClass Library,\u201d giving it an appropriate name.<span>&nbsp; <\/span>I copy and paste my class into that new class library (replacing the default class that got auto-generated).&nbsp;&nbsp;Note that I could have avoided this problem if I had created the class library as a smart device class library last week &#8212; .NET projects can reference SD projects, but not vice-versa!&nbsp; (Thanks again to Daniel for reminding me that I hadn&#8217;t made this clear when I&#8217;d first posted this.)&nbsp; I do need to build the class library (right-click the class library project in the Solution Explorer and choose \u201cBuild\u201d), and then add the reference to MatrixMath in the usual way (right-click MatrixMath in the Solution Explorer, choose \u201cAdd Reference\u2026\u201d, navigate to the Projects tab and select the new class library).<span>&nbsp; <\/span><\/font><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">I also choose the \u201cSet as Startup Project\u201d command on Matrix Math in order to make sure we can debug it correctly later on.<\/font><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">Now, we start leveraging the class library code.<span>&nbsp; <\/span>Right-click the form in the Solution Explorer and choose \u201cView Code.\u201d<span>&nbsp; <\/span>In the resulting editor, I\u2019ll add \u201cImports Matrices\u201d at the top, so that I don\u2019t have to fully qualify my usage of the Matrix class.<span>&nbsp; <\/span>I\u2019ll also add the following class members:<\/font><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>Enum<\/span> operations<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>opNull = 0<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>opAdd = 1<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>opSub = 2<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>opMul = 3<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>End<\/span> <span>Enum<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>Dim<\/span> lastOp <span>As<\/span> operations = operations.opNull<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>Dim<\/span> Accumulator <span>As<\/span> <span>New<\/span> Matrix(4, 4)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>Dim<\/span> ScratchPad <span>As<\/span> <span>New<\/span> Matrix(4, 4)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>Dim<\/span> map(3, 3) <span>As<\/span> TextBox<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><font size=\"3\"><font face=\"Calibri\">The TextBox array held in \u201cmap\u201d will just make it easier for me to map textboxes to coordinates, and I will initialize it in the Load event handler.<span>&nbsp; <\/span><\/font><\/font><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>Private<\/span> <span>Sub<\/span> MatrixForm_Load(<span>ByVal<\/span> sender <span>As<\/span> System.Object, <span>ByVal<\/span> e <span>As<\/span> System.EventArgs) <span>Handles<\/span> <span>MyBase<\/span>.Load<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&#8216; Yecch&#8230;<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>map(0, 0) = M00<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>map(0, 1) = M01<\/span><\/p>\n<p class=\"MsoNormal\"><span>&#8216; Etc&#8230;<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><font size=\"3\"><font face=\"Calibri\">The Accumulator will hold the current value of the matrix, the ScratchPad will hold the matrix that the user is currently defining, and the \u201coperations\u201d enum will help me define &amp; remember what the previous operation was, so that when \u201c=\u201d is pressed, I can apply it.<span>&nbsp; <\/span>(This calculator is a simple accumulator calculator, with no implemented stack to nest operations \u2013 i.e., there is no operator precedence.<span>&nbsp; <\/span>I\u2019ve left that as an exercise for the reader\u2026 <\/font><span><span>J<\/span><\/span><font face=\"Calibri\">)<\/font><\/font><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">Now, we\u2019ll need methods to clear a matrix and also to push a matrix into the edit boxes.<span>&nbsp; <\/span>These are just business as usual:<\/font><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>Private<\/span> <span>Sub<\/span> PushMatrix(<span>ByVal<\/span> m <span>As<\/span> Matrix)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>For<\/span> i <span>As<\/span> <span>Integer<\/span> = 0 <span>To<\/span> 3<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>For<\/span> j <span>As<\/span> <span>Integer<\/span> = 0 <span>To<\/span> 3<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>map(i, j).Text = m.data(i, j)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Next<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Next<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>End<\/span> <span>Sub<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>Private<\/span> <span>Sub<\/span> ClearMatrix(<span>ByVal<\/span> m <span>As<\/span> Matrix)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;<\/span><span>For<\/span> i <span>As<\/span> <span>Integer<\/span> = 0 <span>To<\/span> 3<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>For<\/span> j <span>As<\/span> <span>Integer<\/span> = 0 <span>To<\/span> 3<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>m.data(i, j) = 0.0<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Next<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Next<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>End<\/span> <span>Sub<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><font size=\"3\"><font face=\"Calibri\">Everything else is just event handling.<span>&nbsp; <\/span>First, we need to handle the event where the data in the scratchpad is changed by the user, so that (a) we can update our internal representation of that matrix and (b) update the determinant.<span>&nbsp; <\/span>When I first coded this, I decided that I would handle the TextChanged event, but that was a poor decision because it would fire on every keystroke \u2013 very non-performant, and also ambiguous if you\u2019d just entered a \u201c-\u201c or \u201c.\u201d or other partial number.<span>&nbsp; <\/span>So, instead I went with \u201cLostFocus,\u201d which would fire when the user clicked away from the cell (and before any subsequent event would fire.<span>&nbsp; <\/span>The code is similar for all of the edit boxes, and I\u2019ve consolidated them into one handler to save space, although again we have the problem with mapping a control to an array (this time in the opposite direction):<\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>Private<\/span> <span>Sub<\/span> Matrix_LostFocus(<span>ByVal<\/span> sender <span>As<\/span> System.Object, <span>ByVal<\/span> e <span>As<\/span> System.EventArgs) _<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Handles<\/span> M00.LostFocus, M01.LostFocus, M02.LostFocus, M02.LostFocus, _<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>M10.LostFocus, M11.LostFocus, M12.LostFocus, M13.LostFocus, _<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>M20.LostFocus, M21.LostFocus, M22.LostFocus, M23.LostFocus, _<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>M30.LostFocus, M31.LostFocus, M32.LostFocus, M33.LostFocus<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Dim<\/span> value <span>As<\/span> <span>Double<\/span> = 0<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Try<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>value = <span>CDbl<\/span>(<span>CType<\/span>(sender, TextBox).Text)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span>Catch<\/span> ex <span>As<\/span> Exception<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&#8216; If junk got put in the text box, compensate<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>value = 0<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>CType<\/span>(sender, TextBox).Text = value<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>End<\/span> <span>Try<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>If<\/span> sender <span>Is<\/span> M00 <span>Then<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>ScratchPad.data(0, 0) = value<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>ElseIf<\/span> sender <span>Is<\/span> M01 <span>Then<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>ScratchPad.data(0, 1) = value<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp; <\/span><span>&#8216; Etc\u2026<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>End<\/span> <span>If<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Dim<\/span> det <span>As<\/span> <span>Double<\/span> = ScratchPad.Determinant<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Me<\/span>.DeterminantBox.Text = <span>CStr<\/span>(det)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>End<\/span> <span>Sub<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">Now, I\u2019ve decided that there are three special functions that operate on the scratchpad matrix in place, but don\u2019t modify the accumulator \u2013 Inverse, Transpose, and Scale.<span>&nbsp; <\/span>(These are similar in nature to the Sine, Inverse, etc. functions that you\u2019d find on any calculator, which just operate on the most recent thing you typed in.)<span>&nbsp; <\/span>With our previously defined functions, the first two are very simple.<span>&nbsp; <\/span>For example, here\u2019s the Inverse handler:<\/font><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>Private<\/span> <span>Sub<\/span> InvertBtn_Click(<span>ByVal<\/span> sender <span>As<\/span> System.Object, <span>ByVal<\/span> e <span>As<\/span> System.EventArgs) <span>Handles<\/span> InvertBtn.Click<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>ScratchPad = ScratchPad.Inverse()<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>PushMatrix(ScratchPad)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>End<\/span> <span>Sub<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">&nbsp;<\/font><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">The Scale function is slightly more complicated because we need a value to scale the scratchpad, and the screen is too cramped to add much more functionality.<span>&nbsp; <\/span>Instead, I\u2019m going to use a modal dialog.<span>&nbsp; <\/span>These work identically to their Windows application counterparts.<span>&nbsp; <\/span>To create on, right-click on the MatrixMath project in the Solution Explorer and choose \u201cAdd\u201d then \u201cWindows Form,\u201d giving it an appropriate name like \u201cScalar\u201d before pressing OK.<span>&nbsp; <\/span>In the resulting window, I\u2019ll resize the form to be 200 x 100, and add a label, text box, and \u201cOK\u201d button as shown in Scalar-form.jpg in the attached ZIP file.<span>&nbsp; <\/span>(Don\u2019t forget to set the return Dialog Result property of the OK button to be \u201cOK,\u201d as shown in that same JPG.)<span>&nbsp; <\/span>I will also get rid of the default menu, as with the other form.<span>&nbsp; <\/span>There\u2019s only one event handler in the dialog, which is for the OK button click \u2013 it just calls the following:<\/font><\/p>\n<p class=\"MsoNormal\"><span>Public<\/span><span> <span>Class<\/span> ScalarDlg<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>Private<\/span> <span>Sub<\/span> OKBtn_Click(<span>ByVal<\/span> sender <span>As<\/span> System.Object, <span>ByVal<\/span> e <span>As<\/span> System.EventArgs) <span>Handles<\/span> OKBtn.Click<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Me<\/span>.Close()<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>End<\/span> <span>Sub<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span>End<\/span><span> <span>Class<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">And using the dialog is just as simple:<\/font><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>Private<\/span> <span>Sub<\/span> ScaleBtn_Click(<span>ByVal<\/span> sender <span>As<\/span> System.Object, <span>ByVal<\/span> e <span>As<\/span> System.EventArgs) <span>Handles<\/span> ScaleBtn.Click<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Static<\/span> scalar <span>As<\/span> <span>Double<\/span> = 1.0<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Dim<\/span> dlg <span>As<\/span> <span>New<\/span> ScalarDlg<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>dlg.scalarEdt.Text = scalar.ToString<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>If<\/span> dlg.ShowDialog() = Windows.Forms.DialogResult.OK <span>Then<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Try<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>scalar = <span>CDbl<\/span>(dlg.scalarEdt.Text)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Catch<\/span> ex <span>As<\/span> Exception<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>scalar = 1.0 <span>&#8216; User put in junk; ignore and scale by 1<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>End<\/span> <span>Try<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>If<\/span> scalar &lt;&gt; 1.0 <span>Then<\/span> <span>&#8216; No point if wasting time if nothing will change<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>ScratchPad = scalar * ScratchPad<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>PushMatrix(ScratchPad)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>End<\/span> <span>If<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>End<\/span> <span>If<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>End<\/span> <span>Sub<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">Note that I\u2019ve chosen to make \u201cscalar\u201d a static, so that the last choice will be the default the next time the matrix is scaled.<\/font><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">Next are the operations that do affect the accumulator.<span>&nbsp; <\/span>The general \u201cinfix\u201d plan for those is:<\/font><\/p>\n<p class=\"MsoListParagraphCxSpFirst\"><span><span><font face=\"Calibri\" size=\"3\">1)<\/font><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><font face=\"Calibri\" size=\"3\">The user types in a scratchpad matrix and then presses +, -, or *.<\/font><\/p>\n<p class=\"MsoListParagraphCxSpMiddle\"><span><span><font face=\"Calibri\" size=\"3\">2)<\/font><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><font face=\"Calibri\" size=\"3\">The scratchpad gets pushed to the accumulator and the last operation type is cached.<\/font><\/p>\n<p class=\"MsoListParagraphCxSpMiddle\"><span><span><font face=\"Calibri\" size=\"3\">a.<\/font><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><font face=\"Calibri\" size=\"3\">Note that, like a normal calculator, the scratchpad doesn\u2019t get cleared after being pushed, so that it is essentially the default value for the next operation.<\/font><\/p>\n<p class=\"MsoListParagraphCxSpLast\"><span><span><font face=\"Calibri\" size=\"3\">3)<\/font><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><font face=\"Calibri\" size=\"3\">The user modifies the scratchpad as normal and then presses +, -, *, or =.<span>&nbsp; <\/span>The accumulator and the scratch pad are acted upon by the previously cached operation request, the result is placed in the accumulator and presented on the scratchpad, and the new operation request is cached.<span>&nbsp; <\/span>(In the case of \u201c=\u201d, the last operation is Null, the operation of which will be essentially a \u201cno-op.\u201d <\/font><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">The code then is just:<\/font><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>Private<\/span> <span>Sub<\/span> OpBtn_Click(<span>ByVal<\/span> sender <span>As<\/span> System.Object, <span>ByVal<\/span> e <span>As<\/span> System.EventArgs) _<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Handles<\/span> AddBtn.Click, SubtractBtn.Click, MultBtn.Click, EqualBtn.Click<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Select<\/span> <span>Case<\/span> lastOp<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Case<\/span> operations.opAdd<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Accumulator = Accumulator + ScratchPad<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>ScratchPad.Copy(Accumulator)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>PushMatrix(ScratchPad)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Case<\/span> operations.opMul<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Accumulator = Accumulator * ScratchPad<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>ScratchPad.Copy(Accumulator)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>PushMatrix(ScratchPad)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Case<\/span> operations.opSub<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Accumulator = Accumulator &#8211; ScratchPad<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>ScratchPad.Copy(Accumulator)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>PushMatrix(ScratchPad)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Case<\/span> operations.opNull<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&#8216; We haven&#8217;t done any ops yet, so just push it into the accumulator.<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Accumulator.Copy(ScratchPad)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>End<\/span> <span>Select<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>If<\/span> sender <span>Is<\/span> AddBtn <span>Then<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>lastOp = operations.opAdd<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>ElseIf<\/span> sender <span>Is<\/span> SubtractBtn <span>Then<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>lastOp = operations.opSub<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>ElseIf<\/span> sender <span>Is<\/span> MultBtn <span>Then<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>lastOp = operations.opMul<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>ElseIf<\/span> sender <span>Is<\/span> EqualBtn <span>Then<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>lastOp = operations.opNull<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>End<\/span> <span>If<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>End<\/span> <span>Sub<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">In the class library for the matrices, you\u2019ll note that I added a \u201cCopy\u201d method which simply copies the contents of one matrix to another if they are the same size, in order to make the above operations easier.<span>&nbsp; <\/span>This wasn\u2019t strictly necessary \u2013 I could have simply said ScratchPad = 1.0 * Accumulator, but that\u2019s lame and poor use of memory (since a new matrix would be created).<span>&nbsp; <\/span>What I <b><i>couldn\u2019t<\/i><\/b> do would be to say \u201cScratchPad = Accumulator,\u201d since that would not copy the data but instead would copy the reference to that data, so that both Accumulator and ScratchPad would be pointing to the same object instance \u2013 that would be very bad unless I subsequently assigned Accumulator to point to a different matrix.<span>&nbsp; <\/span>Nor is there any way to do operating overloading on \u201c=\u201d as an assignment, because that would block the very referencing assignment I just mentioned.<span>&nbsp; <\/span>Thus, a \u201cCopy\u201d routine is required.<\/font><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">Finally, I need to support the CE and AC buttons, but these just leverage the \u201cClearMatrix\u201d and \u201cPushMatrix\u201d methods.<span>&nbsp; <\/span>AC resets everything:<\/font><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>Private<\/span> <span>Sub<\/span> ACBtn_Click(<span>ByVal<\/span> sender <span>As<\/span> System.Object, <span>ByVal<\/span> e <span>As<\/span> System.EventArgs) <span>Handles<\/span> ACBtn.Click<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>ClearMatrix(Accumulator)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>ClearMatrix(ScratchPad)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>PushMatrix(ScratchPad)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Me<\/span>.DeterminantBox.Text = <span>CStr<\/span>(0)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>lastOp = operations.opNull<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>End<\/span> <span>Sub<\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">While CE just clears the scratch pad matrix, but not the accumulator or last operation:<\/font><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>Private<\/span> <span>Sub<\/span> CEBtn_Click(<span>ByVal<\/span> sender <span>As<\/span> System.Object, <span>ByVal<\/span> e <span>As<\/span> System.EventArgs) <span>Handles<\/span> CEBtn.Click<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>ClearMatrix(ScratchPad)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>PushMatrix(ScratchPad)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>Me<\/span>.DeterminantBox.Text = <span>CStr<\/span>(0)<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>&nbsp;&nbsp;&nbsp; <\/span><span>End<\/span> <span>Sub<\/span><\/span><\/p>\n<h2><font face=\"Cambria\" color=\"#4f81bd\" size=\"4\">Debugging and execution<\/font><\/h2>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">At some point you\u2019ll want to start debugging your code, and copying it over to a Windows app to do this would be wasteful.<span>&nbsp; <\/span>Fortunately, you don\u2019t have to do that; Visual Studio comes with useful smart device emulators.<span>&nbsp; <\/span>Assuming you\u2019ve set the MatrixMath project to be the startup project as described above, then simply hit F5.<span>&nbsp; <\/span>You\u2019ll be presented with a list of choices for debugging.<span>&nbsp; <\/span>You can deploy the app to a connected device and run it \u201cfor real\u201d on there, debugging as usual, or you can choose one of the emulators presented.<span>&nbsp; <\/span>I have an attached device, but I prefer not to deploy any application to it until I know that it\u2019s bug free, so I always choose \u201cPocket PC 2003 SE Emulator.\u201d<span>&nbsp; <\/span>The emulator has identical functionality to an actual device of that type.<span>&nbsp; <\/span>When you deploy to it, it will take a minute to get it onto the emulated device because it really is \u201cinstalling\u201d it there.<span>&nbsp; <\/span>You can then set breakpoints in your code and debug as usual, even checking values.<span>&nbsp; <\/span>(Note that I created the project as a Windows CE 5.0 project, but am debugging it using the Pocket PC emulator.<span>&nbsp; <\/span>Both can use .NET CF 2.0; I\u2019ve stuck to basic functionality, and so there\u2019s no problem here.)<\/font><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">There\u2019s something else cool that you can do, though.<span>&nbsp; <\/span>Note that .NET CF is an almost perfect subset of .NET, and so you can actually run your application right on your desktop machine!<span>&nbsp; <\/span>Just dig down to the EXE that got built below your project directory, and double-click it \u2013 the application should run like it would on the handheld, provided that you didn\u2019t write any code specific to the various buttons on the handheld.<\/font><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">That about wraps it up for this week.<span>&nbsp; <\/span>The final code is attached in the ZIP file, as usual.<span>&nbsp; <\/span>Next week I&#8217;m hoping to write a mercifully shorter post which discusses snippets and error correction.<span>&nbsp; <\/span>\u2018Til then\u2026<\/font><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">&#8211;Matt&#8211;*<\/font><\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Components.PostAttachments\/00\/02\/63\/08\/42\/Matrices.zip\">Matrices.zip<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week I talked a bit about operator overloading, and used the concept to support a library of matrix functions.&nbsp; This week, we\u2019ll use those functions in a Smart Device application to create a matrix calculator. Smart Device applications It\u2019s extremely easy to create an application for your Smart Device.&nbsp; Let\u2019s start from the solution [&hellip;]<\/p>\n","protected":false},"author":258,"featured_media":8818,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[22,195],"tags":[101,140,165],"class_list":["post-6093","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-matt-gertz","category-visual-basic","tag-matt-gertz","tag-smart-devices","tag-vb2005"],"acf":[],"blog_post_summary":"<p>Last week I talked a bit about operator overloading, and used the concept to support a library of matrix functions.&nbsp; This week, we\u2019ll use those functions in a Smart Device application to create a matrix calculator. Smart Device applications It\u2019s extremely easy to create an application for your Smart Device.&nbsp; Let\u2019s start from the solution [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/6093","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/users\/258"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/comments?post=6093"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/6093\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media\/8818"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media?parent=6093"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/categories?post=6093"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/tags?post=6093"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}