|
The
Form design, agenda_task.vb
Create Visual Basic 2010 Forn -
agenda_task.vb
Classes used in this Form:
PictureBox, RadioButton, Button,
ImageList, TextBox, Label, GroupBox
-
Create the Form
agenda_task.vb
Add New Item -
agenda_task.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_task.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_task.vb created, appears the empty window Form
design |
|
|
The codes file, created
... |
Public
Class
agenda_task
Private
Sub
agenda_task_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 p_high.bmp,
p_low.bmp, p_normal.bmp,
btn_cancel.bmp, btn_ok.bmp
|
2. |
The
agenda_task.vb
design |
|
 |
The Properties of
the Form -
agenda_task.vb... |
Name: Icon: Maximize: Menu: Size: Start
Position: Text: Window
State: |
agenda_task Icon False (none) 368,332 CenterScreen
agenda_task
... Normal | | | |
3. |
From the Toolbox/Windows Form add these
controls . .3
PictureBox controls, 1 GroupBox control, 3
RadioButton controls, 2 Button
controls, 1 ImageList control, 1
TextBox control, 1 Label
control |
|
- Add
t3 PictureBox
control
- PicA1,
PictureBox
Properties
Name:
Image:
Size
Mode: |
Picico
System.Drawing.Bitmap
Autosize | |
Bitmap file
added =
C:\work_VBNet_10\work_VBNet_10\pic\p_high.bmp
- PicA2 -
Bitmap file
added =
C:\work_VBNet_10\work_VBNet_10\pic\p_low.bmp
- Pic\A3
- Bitmap file
added =
C:\work_VBNet_10\work_VBNet_10\pic\p_normal.bmp
|
- Add
the GroupBox
control - GroupBox1
Properties:
Name: Size:
Text: |
GroupBox1 104, 84 task
prirority | |
- Add
2
RadioButton
controls
-
rad_ligh,
RadioButton
Properties
Name:
Text: |
rad_ligh
light | |
- rad_low
Text:
low
- rad_normal
Text:
normal
|
- Add
the Button control
- btn_ok,
Button
Properties
Name:
ImageIndex:
ImageList:
Size:
Text: |
btn_ok
0
ImageList1
65,24
| |
- btn_cancel
ImageIndex:
1
|
- Add
the ImageList control
-
ImageList1, ImageList
Properties:
Name:
Images:
ImageSize: |
ImageList1
(Collection) - of 2
Bitmap
images
56,
36 | |
The folder
c:\work_VBNet_10\work_VBNet_10\pic stored the 2 bmp files
btn_cancel.bmp, btn_ok.bmp
- Add
the TextBox
control
- txtdescription, TextBox
Properties
Name: Multiline: Size: Text: |
txtdescription True 400,
84 | |
- Add
the Label
control
- ldescription, Label
Properties
Name: Font: Size: Text: TextAlign: |
ldescription Microsoft Sans
Serif,
8.25pt 80, 16 description
TopLeft | | | | |
|
agenda_task.vb file, the codes after modification
...
|
|
Public
Class
agenda_task
Inherits
System.Windows.Forms.Form
Private
Sub
agenda_task_Load(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
MyBase.Load
'new task & edit task
Select
Case
task_type
Case
"new"
Me.Text =
"new task"
Me.txtdescription.Text
= ""
Me.rad_ligh.Checked
= 0
Me.Rad_normal.Checked
= 1
Me.Rad_low.Checked =
0
task_prirority =
"N"
Case
"edit"
Me.Text =
"edit task"
Me.txtdescription.Text
= agenda_desc
Select
Case
task_prirority
Case
"H"
Me.rad_ligh.Checked
= 1
Me.Rad_normal.Checked
= 0
Me.Rad_low.Checked =
0
Case
"N"
Me.rad_ligh.Checked
= 0
Me.Rad_normal.Checked
= 1
Me.Rad_low.Checked =
0
Case
"L"
Me.rad_ligh.Checked
= 0
Me.Rad_normal.Checked
= 0
Me.Rad_low.Checked =
1
End
Select
End
Select
Me.Btn_cancel.Left =
(Me.txtdescription.Left
+ Me.txtdescription.Width)
- Me.Btn_cancel.Width
Me.Btn_ok.Enabled =
False
Me.txtdescription.Focus()
End
Sub
Private
Sub
rad_ligh_CheckedChanged(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
rad_ligh.CheckedChanged
If
Me.rad_ligh.Checked
=
True
Then
Me.Rad_normal.Checked
= 0
Me.Rad_low.Checked =
0
task_prirority =
"H"
If
Me.Btn_ok.Enabled
=
False
Then
Me.Btn_ok.Enabled
=
True
Me.txtdescription.Focus()
End
If
End
Sub
Private
Sub
Rad_normal_CheckedChanged(ByVal
sender
As
Object,
ByVal
e As
System.EventArgs)
Handles
Rad_normal.CheckedChanged
If
Me.Rad_normal.Checked
=
True
Then
Me.rad_ligh.Checked
= 0
Me.Rad_low.Checked =
0
task_prirority =
"N"
If
Me.Btn_ok.Enabled
=
False
Then
Me.Btn_ok.Enabled
=
True
Me.txtdescription.Focus()
End
If
End
Sub
Private
Sub
Rad_low_CheckedChanged(ByVal
sender
As
Object,
ByVal
e As
System.EventArgs)
Handles
Rad_low.CheckedChanged
If
Me.Rad_low.Checked
=
True
Then
Me.rad_ligh.Checked
= 0
Me.Rad_normal.Checked
= 0
task_prirority =
"L"
If
Me.Btn_ok.Enabled
=
False
Then
Me.Btn_ok.Enabled
=
True
Me.txtdescription.Focus()
End
If
End
Sub
Private
Sub
txtdescription_KeyPress(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.KeyPressEventArgs)
Handles
txtdescription.KeyPress
If
Me.Btn_ok.Enabled
=
False
Then
Me.Btn_ok.Enabled
=
True
End
Sub
Private
Sub
Btn_ok_Click(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles Btn_ok.Click
If
Me.txtdescription.Text
<>
""
Then
Select
Case
task_type
Case
"new"
task_flag =
True
agenda_desc =
Me.txtdescription.Text
Close()
fagenda.afternew_task()
Case
"edit"
task_flag =
True
agenda_desc =
Me.txtdescription.Text
Close()
fagenda.afteredit_task()
End
Select
Else
MsgBox( "description
value, empty ... not available",
MsgBoxStyle.DefaultButton1
Or
MsgBoxStyle.Information
Or
MsgBoxStyle.OKOnly,
Title)
End
If
End
Sub
Private
Sub
Btn_cancel_Click(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
Btn_cancel.Click
task_flag =
False
agenda_desc =
""
task_prirority =
""
Me.Close()
End
Sub
End
Class
| | |
|
|