|
The Form design, Mainform.vb
Rename the
Form Form1.vb created and add new controls to it
Classes used in this Form:
MainMenu, PictureBox and Label
1- Rename the Form
- On the View
menu , click Solution Explorer
- In Solution
Explorer, expand the RBT Accounting Net project node
and select Form1.vb
- In Properties
windows, Type the new File Name
|
Old |
New |
Filename : |
Form1.vb |
MainForm.vb | | |
2- Add Folder and all
picture files to by be used by this form or other forms
of the current application
- Create new
Folder
- On the
View menu , click Solution
Explorer
- In
Solution Explorer, expand the
RBT Accounting Net project node, click Right mouse
Button, click Add of the Popup menu, and
the click New Folder
- New
Folder appears in the Solution Explorer.
Rename it - pic
|
- Add all
Picture Files to be used by this form or other forms of
the current application
- Copy
the following Picture files from the
source folder - \\RBT
Accounting Net\pic of CD-Rom - Teach_VNet
to the destination folder - c:\RBT Accounting Net\pic
Picture files
|
Picture files |
Picture files |
ageneral.ico
aRBT.bmp
CLOSE.BMP
Delete.bmp
exchange.ico
FIRST.BMP |
guide.ico
LAST.BMP
NEW.BMP
NEXT.BMP
PREV.BMP
product.ico |
RBTdesn.bmp
RBTdesn1.bmp
RBTdesn2.bmp
sales.ico
SAVE.BMP |
|
- On the
Projet menu , click Add Existing Item
..., Add Existing Item - RBT Accounting Net dialog
box appears, select all Picture files of the folder
c:\RBT Accounting Net\Pic, and then click
Open. All these Picture files added to the
folder pic
|
|
3- Modify the Form Properties
...
- On the View
menu , click Solution Explorer
- In Solution
Explorer, expand the RBT Accounting Net project
node
- Right click the
MainForm.vb and click View Designer
on the shortcut menu to open the Properties
Windows.
- In Properties
windows, modify ...
|
Old |
New |
Name: FormBorderStyle Icon: Menu: Size: Text: Window
State: |
Form1 Sizable Icon (none) 300,300 Form1 Normal |
MainForm FixedSingle Icon mainMenu1
472,328 Main
Form
... Maximized | | | |
|
|
1. |
Create Module
On the View
menu , click Solution Explorer
In Solution
Explorer, right click the RBT Accounting Net , select
Add on the shortcut menu to open other shortcut menu,
click Add New Item, the Add New Item -
RBT Accounting Net dialog box appears.
In the Add
New Item -RBT Accounting Net dialog box:
In the
Categories pane, select Local Project
Items
In the Templates
pane, select Module icon . A message appears
- (A file for storing groups of functions).
In the Name
box, type Module1.vb
Click Open, in
the Solution Explorer display new item -
Module1.vb |
|
2. |
Set new Startup object -
Sub Main
- On the
Project menu , click RBT Accounting Net Properties
..., the RBT Accounting Net Property Pages dialog box
appears
- In the Startup
object combo box, choose and select
Sub
Main
- Click
OK
|
3. |
The codes ...
Module
Module1Public
Title As
String
= "RBT Accounting .Net Message"
Sub
Main()
' Instantiate a new
instance of Form.
Dim
fMain As
New
MainForm
' Show the instance
of the form modally.
fMain.ShowDialog()
End
Sub
End
Module |
|
|
1- |
The MainForm.vb
design |
|
 |
2- |
From the Toolbox/Windows Form add these
controls .
..
|
|
- Add the PictureBox
control - PictureBox1,
PictureBox Properties:
Name: Image: Size
Mode: |
PictureBox1 System.Drawing.Bitmap Autosize | |
Bitmap file
added =
C:\RBT Accounting Net\pic\aRBT.bmp
- Add the Label
control
- Label1, Label
Properties:
Font: Name: Size: Text: TextAlign: |
Times New Roman, 9.75pt,
style=Bold, Italic Label1: 576,24
Application developed with Visual Basic .Net ,
but ... MiddleCenter | |
- Add the MainMenu
control, MainMenu1
The
MainMenu control represents the container for
the menu structure of a form. A menu is composed of
MenuItem objects that represent the individual menu
commands in the menu structure. Each MenuItem
can be a command for your application or a parent menu
for other submenu items.
Add to this menu - MainMenu1 the
following items menu
Item |
Name |
Text |
1 1.1 1.2
1.3 2 2.1 3
3.1 3.2
3.3 4 4.1 |
MenuItem1 MenuItem2 MenuItem3 MenuItem4 MenuItem5 MenuItem6
MenuItem7 MenuItem8 MenuItem9 MenuItem10 MenuItem11 MenuItem12 |
File
Introductory - Exit Sales Sales Form
UNO Account Form Exchange Form Product
Form About About Form |
The menu
design
...
| | | |
|
MainForm.vb file, the
code ... |
|
Public
Class
MainFormInherits
System.Windows.Forms.Form
Windows Form Designer
generated code |
Private
Sub
MainForm_Load(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs)
Handles
MyBase.LoadMe.PictureBox1.Left
= (Me.Width
- Me.PictureBox1.Width)
/ 2
Me.PictureBox1.Top
= Me.Height
* 2 / 3 - Me.PictureBox1.Height
Me.Label1.Left
= (Me.Width
- Me.Label1.Width)
/ 2
Me.Label1.Top
= Me.PictureBox1.Top
+ Me.PictureBox1.Height
+ (Me.Height
/ 8) ' -
(Me.PictureBox1.Top + Me.PictureBox1.Height +
Me.Label1.Height)) / 2
End
Sub
Private
Sub
MenuItem2_Click(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs)
Handles MenuItem2.Click
Dim
fintrod As
New
IntrodForm
fintrod.Show()
End
Sub
Private
Sub
MenuItem4_Click(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs)
Handles MenuItem4.Click
Application.Exit()
End
Sub
Private
Sub
MenuItem6_Click(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs)
Handles MenuItem6.Click
Dim
fsales As
New
salesForm
fsales.Show()
End
Sub
Private
Sub
MenuItem8_Click(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs)
Handles MenuItem8.Click
Dim
fAccount As
New
AccountForm
fAccount.Show()
End
Sub
Private
Sub
MenuItem9_Click(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs)
Handles MenuItem9.Click
Dim
fExchange As
New
ExchangForm
fExchange.Show()
End
Sub
Private
Sub
MenuItem10_Click(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs)
Handles MenuItem10.Click
Dim
fProduct As
New
ProductForm
fProduct.Show()
End
Sub
Private
Sub
MenuItem12_Click(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs)
Handles MenuItem12.Click
Dim
fabout As
New
About
fabout.Show()
End
Sub
End
Class | | |
|
|
1. |
The IntrodForm.vb
design
|
2. |
From the Toolbox/Windows Form add :
-
PictureBox
control - PictureBox1
-
Button
control - btndone
. |
3. |
The code ..
Public
Class
IntrodForm
Inherits System.Windows.Forms.Form
Windows Form Designer
generated code |
Private
Sub
btndone_Click(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs)
Handles btndone.Click
Me.Close()
End
Sub
End
Class |
|
|
|
|