|
The
Form design, agenda_time.vb
Create Visual Basic 2010 Forn -
agenda_time.vb
Classes used in this Form: PictureBox,
Panel, RadioButton,
ListBox
-
Create the Form
agenda_time.vb
Add New Item -
agenda_time.vb Form to work_VBNet_10
Project
- On the Projet
menu , click Add New Item ...,
Add New Item - work_VBNet_10 dialog box appears, Select
Windows form Icon,
in the Name box type
agenda_time.vb and then click
Add.
|
 |
|
Note:
In the Windows Forms Designer appears the
design form created and in the Properties
Windows displays the corresponding properties
and
The design Form agenda_time.vb created, appears the empty window Form
design |
|
|
The codes file, created
... |
Public
Class
agenda_time
Private
Sub
agenda_time_Load(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
MyBase.Load
End
Sub
End
Class
|
|
|
|
1. |
Picture files used by this form ...
|
|
- The folder
c:\work_VBNet_10\work_VBNet_10\pic stored the
bmp files time_am.bmp,
time_pm.bmp, time_title.bmp,
p_close.bmp
|
2. |
The
agenda_time.vb
design |
|
 |
The Properties of
the Form -
agenda_time.vb... |
Name: Icon: FormBorderstyle: Menu: Size: Start
Position: Text: Window
State: |
agenda_time Icon
None (none) 156, 140
Manual agenda_time
... Normal | | | |
3. |
From the Toolbox/Windows Form add these
controls .... 4 PictureBox controls,
4 Panel controls, 2 RadioButton
controls, 1 ListBox controls
|
|
- Add
4 PictureBox
controls
- PictureBox1,
PictureBox
Properties
Name:
Image:
Size
Mode: |
PictureBox1
System.Drawing.Bitmap
Autosize | |
Bitmap file
added =
C:\work_VBNet_10\work_VBNet_10\pic\
p_close..bmp
- PictureBox2
- Bitmap file
added =
C:\work_VBNet_10\work_VBNet_10\pic\
time_title.bmp
- Pic\A1
- Bitmap file
added =
C:\work_VBNet_10\work_VBNet_10\pic\time_am
.bmp
- PicA2 -
Bitmap file
added =
C:\work_VBNet_10\work_VBNet_10\pic\time_pm.bmp
|
- Add
4 Panel
controls
- Panel1,
Panel
Properties
Name:
Size: |
Panel1
4,
136 | |
- Panel2
-
Size: 4,
136
- Panel3
-
Size:
156, 4
- Panel4
-
Size:
156,
4
|
- Add
2
RadioButton
controls
-
RadAM,
RadioButton
Properties
- RadPM
Text:
PM
|
- Add
the ListBox control
-
Listtime, ListBox
Properties:
Name: Size: |
Listtime 72,
121 | |
| | |
|
agenda_time.vb file, the codes after modification
...
|
|
Public
Class
aganda_time
Inherits
System.Windows.Forms.Form
Dim j
As
Integer
Dim i
As
Integer
Dim vi
As
String
Dim vj
As
String
Dim vitem
As
Integer
Private
Sub
aganda_time_Load(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
MyBase.Load
Dim vleft
As
Integer
Dim vtop
As
Integer
'
Moved Class
vleft = fagenda_appoint.Left +
fagenda_appoint.txttime.Left
vtop = fagenda_appoint.Top +
fagenda_appoint.txttime.Top +
fagenda_appoint.txttime.Height * 5 / 2
Me.Location =
New
Point(vleft, vtop)
time_flag =
False
Me.RadAM.Checked = 1
End
Sub
Private
Sub
RadAM_CheckedChanged(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
RadAM.CheckedChanged
If
Me.Listtime.Items.Count
> 0
Then
vitem = ( Me.Listtime.Items.Count
- 1)
Me.Listtime.Items.Clear()
End
If
For
Me.i
= 0
To 11
For
Me.j
= 0
To 55
Step
5
vi = Format(i,
"00")
vj = Format(j,
"00")
Me.Listtime.Items.Add(Trim(vi
&
":" & vj &
" AM"))
Next
Next
If
Me.RadAM.Checked
= 1
Then
Me.RadPM.Checked
= 0
End
Sub
Private
Sub
RadPM_CheckedChanged(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
RadPM.CheckedChanged
If
Me.Listtime.Items.Count
> 0
Then
vitem = ( Me.Listtime.Items.Count
- 1)
Me.Listtime.Items.Clear()
End
If
For
Me.i
= 12
To
23
For
Me.j
= 0
To 55
Step
5
vi = Format(i,
"00")
vj = Format(j,
"00")
Me.Listtime.Items.Add(Trim(vi
&
":" & vj &
" PM"))
Next
Next
If
Me.RadPM.Checked
= 1
Then
Me.RadAM.Checked
= 0
End
Sub
Private
Sub
Listtime_SelectedIndexChanged(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
Listtime.SelectedIndexChanged
appoint_time =
Me.Listtime.SelectedItem
time_flag =
True
End
Sub
Private
Sub
PictureBox1_Click(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
PictureBox1.Click
sub_close()
End
Sub
Private
Sub
sub_close()
Dim response
As
MsgBoxResult
If time_flag
Then
fagenda_appoint.sub_timeok()
Close()
End
If
If time_flag =
False
Then
response = MsgBox( "Time,
not selected ...",
MsgBoxStyle.DefaultButton2
Or
MsgBoxStyle.Information
Or
MsgBoxStyle.YesNo,
Title)
If (response =
MsgBoxResult.Yes)
Then
Close()
If (response =
MsgBoxResult.No)
Then
Exit
Sub
End
If
End
Sub
Private
Sub
PictureBox2_Click(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
PictureBox2.Click
sub_close()
End
Sub
End
Class
| | |
|
|