CONVERSION FROM
VB.NET TO ASP.NET
- Make
sure that you have IIS (Internet Information Server) 4.0 or higher installed
on your computer as well as .NET Framework. Windows 2000 and XP come with
IIS 5.0. If you are not sure if the server that you are using has .NET, use
your local computer as the server. In many cases you may be prompted to
download the .NET Framework.
- Open
VS.NET, click on New Project
- Select
VB for Project type and ASP.NET Web Applications as the template. Select
local host as the server. NOTE: the name will be WebApplication1 and you
will be given the chance to change the name in a later step. (to change
the name of an application simply click on it then right click and select
rename.) Click OK. If you
have a project for the Web you will get the same dialog box that you see
here.
- The
screen in front of you now is the Flow Layout screen. When you converted the
VB project to C# all you had to do was copy the objects onto the new form.
When converting to the ASP.NET, you are not able to copy the form BUT you
can copy the code. The form and the controls have different coding for the
Web as well as a different Properties list (also to reflect the Web.) If you
look at the VB instruction sheet and follow the first five major steps in
the creation of the form you will have a similar look.
- Please
note that there is no Picture Box and that you will use the Image (there are
two items with Image a button and an Image) Click on the Image and place in
the same spot as the picture box on your form.
- Set
the button properties as you would in VB with a twist. For the second button
instead of typing End type Stop (this will make it easier when you code this
button).
- Set
Label properties. You will repeat these instructions for all three numeric
labels:
·
Click on the label and right click to the properties window
·
Set border style to solid (or your choice)
·
Set text to blank (delete label)
·
Set font (your choice again) the difference here is that there is
not exact size option Medium works best.
·
Double click on Font
·
Set Bold to true (another difference)
·
Click on Name. click down arrow, select font
·
Click on size (as above medium works best)
·
Repeat for the other 2 labels
SAVE ALL HERE (just to be on the safe side)
- Select
your own colors, fonts etc. by following the steps above.
- Setting
the Image properties. This step is very important.
- Open
the properties window for the Image.
- Set
border style
- Click
on Image URL and click on the ellipses. A dialogue box will appear showing
the project contents and files of type. Locate the browse button next to
the URL address. Find the file you wish to use as the image (remember that
if you are using the local server, the file will have to be found on your
computer. If you have the ability to host the page on the net then get the
image from www.mvhs.net/images .
When you find the file highlight it and click open then click ok.
- As
in VB set visible to false
Click on the
form
·
Click on bgcolor and select from the many offerings
SAVE ALL HERE
Now is the time to code the objects
- Double
click on the SPIN button
·
Open the text file that contains the VB code or open the VB
program and go to the code.
·
Highlight and copy the code found in Private Sub Button1_click
·
Switch back to the ASP.NET code and paste the copied code into the
area for Button1.
·
CHANGE the term PICTUREBOX1 to IMAGE1 in the two places where it
occurs and SAVE ALL.
- Select
button2 from the drop down list at the top left of the code
·
Declaration should appear in the next drop down list box on the
right.
·
At the declaration box select click or command
·
In the code section type STOP (End does not work)
SAVE ALL HERE
- Ensure
Randomization
·
While in the code window scroll up until you see Private Sub
Page_Load
·
Below the comment insert Randomize ()
SAVE ALL
Run the page