Page 6 - 1912
P. 6

The following screen shot shows the code window
                                                                displaying the key VB.Net code loop that does the
                                                                image file renames. You can right click on it and
                                                                choose “Copy Image” to copy the screen shot to an
                                                                image editor like MS Paint to view it in more detail.





           Visual Studio 2019 Developer Interface – Design
                                View


         In the Design view, the program’s window appears
         as it would look when it is running. The developer
         can drag and drop Windows “Controls” (buttons, text
         boxes, check boxes, labels, dropdown lists, …) onto
         the program window and then set their properties by    Visual Studio 2019 Developer Interface – Code View
         dragging with the mouse or by typing into the
         control’s property sheet. Controls can be given
         meaningful names (e.g. btnRenameFiles instead of       I’ve uploaded the Picture Renamer program to the
         Button1) to make the underlying program code           club website as a .zip file. The direct hyperlink is:
         easier to understand.                                  http://www.scscc.club/smnr/PictureRenamer.zip. Just
                                                                click the link or copy and paste it into your web
         Once the program’s window is laid out nicely, with all   browser’s address bar. Your browser will download
         the controls properly sized and aligned, the           the .zip file to your PC’s hard drive. If you’re
         developer moves to the Code view and enters the        interested in getting the source code and project
         program code needed to operate the user interface      files, send me an email at tomburt89134 *at) cox.net
         and perform the application’s functions. When a user   and I’ll send you a .zip file with the complete
         clicks on or types into a Control, that action is      package.
         converted by Windows into a message that is sent to
         the application indicating which Control was acted     Unlike many Windows programs, the Picture
         on and what type of action it was (click, double-click,   Renamer does not need to be installed; just copy it
         keypress). Each such message is received by the        to some folder on your hard drive To run the Picture
         program and concerted by the .Net runtime to a         Renamer, just double-click on the
         function call to an event handler. The developer       PictureRenamer.exe file. To make a desktop
         codes event handlers for actions he/she wants the      shortcut, left click the PictureRenamer.exe file to
         program’s UI to respond to in some special way.        select it, then right-click to bring up a context menu.
                                                                Choose “Send to” and then “Desktop (create
         In this example, they key action is the user clicking   shortcut)”.
         on the “Rename Files” button. That action triggers a
         Click event that is sent to the Click handler function
         for the “Rename Files” button. That Click event
         handler function executes a sequence of VB.Net
         code instructions that carries out the actual series of
         file renames for the image files in the designated
         folder. In the programming world, this is called an
         event-driven, object-oriented model.






                                                              6
   1   2   3   4   5   6   7   8   9   10   11