NET Web Forms Visual Studio 2002 by Jerry
. NET Web Forms Visual Studio © 2002 by Jerry Post 1
Visual Studio is a Text Editor Ø Intellisense v v Indents automatically Pops up object choices Shows you function and subroutine values Me. In C# it is this. 2
Useful Tricks Ø Get a video screen with really high resolution. Ø It is possible to open files in separate windows. Ø Use Format v Alignment: q Note that the first clicked item is the one adjusted (e. g. , Bottoms). q In a list, the one with the unfilled box marks is the reference item, others will move. v Vertical and Horizontal Spacing Ø Use drag-and-drop to auto-size items on a form. Ø Use Ctrl-K + Ctrl-C to comment an entire block, Ctrl-K + Ctrl-U to uncomment a block. Ø Drag-and-drop a style sheet file to link it easily. But it usually will not take effect until you run the program. Ø To generate a dataset, right-click on the adapter to set most of the default values automatically. Ø Do not put numbers after a Data. Set name. The generator does it for you. Ø Choose one language and stick with it. You cannot mix and match. 3
Solutions and Projects Ø Ignore “Solutions. ” They are supposed to let you combine projects but it does not work properly. Ø Yes, you can compile multiple projects. But the projects remain completely separate. v You can call a form from one project to another. v But the session variables are completely different. Ø If you really want to combine multiple projects v Compile outside of Visual Studio and use command-line to build an assembly. v Compile the first one separately, and copy the. aspx and. DLL files into the main project root and bin directories respectively. Then add a reference to the first’s DLL. Then compile main. Ø Also, just try getting rid of earlier projects. v Delete files manually (be careful, they are in several places). v Edit the registry! 4
Creating Event Functions Ø Events trigger calls to functions v The functions must have the proper parameters. v The functions must be registered or linked to the event. Ø For buttons: double-click on the button on the form. Ø For other events: v Select the object in the top-left select box v Select the event in the top-right select box Ø You can programmatically create links from events to eventhandlers; usually in Page_Init (which must itself be linked as an event-handler). 5
Help Ø You need the MSDN Library DVD Ø Organization choices v Contents v Search v Index Hierarchical structure Limited text searching Key words Ø To find anything, make sure you set Filtered By v Visual Basic v. NET Framework SDK Language questions Web issues 6
Debug and Trace Ø For. NET, best to debug on a workstation not the server Ø Set breakpoints in code, Start with F 5 or Debug + Start Ø Useful Windows (View + …) v v v Breakpoints Set properties to enable conditional breaks Variables: Locals, Me, Autos (also roll over the variable) Exceptions (errors) Call Stack (see where you came from) Command Issue commands, but lots of typing Immediate From command: Debug. Immediate q ? Variable q Commands Displays value Any acceptable VB command (useful to test) Ø Debug and Trace (same thing but Trace statements remain in compiled code) v Debug. Write. Line(“Program has reached point A”) v Debug. Write. Line. If(ID > 100, “ID is too large”) v Trace. Listeners. Add(…) You can route the output to almost anywhere, including e-mail! 7
Visual Studio Form Design Solution Explorer Menu Save all Toolbars Controls Design/Layout form HTML/ASPX Additional windows (help, output, debug, …) Reference Properties 8
- Slides: 8