Public
Class
detailsControl
Private
Sub
ComboBox1_SelectedIndexChanged(
ByVal
sender
As
System.
Object
,
e
System.EventArgs)
Handles
ComboBox1.SelectedIndexChanged
Select
Case
ComboBox1.SelectedIndex
0
ComboBox2.SelectedIndex = 0
1, 2, 3
ComboBox2.SelectedIndex = 1
Else
ComboBox2.SelectedIndex = -1
End
setDetails(
p
Person)
ComboBox1.SelectedIndex = p.name.title
TextBox1.Text = p.name.firstName
TextBox2.Lines = p.name.middleName
TextBox3.Text = p.name.lastName
ComboBox2.SelectedIndex = p.Sex
DateTimePicker1.Value = p.dob
Function
getName()
Name
Dim
m
New
List(Of
String
)(TextBox2.Lines)
m.RemoveAll(
(s) s.Trim =
""
)
Return
Name(
DirectCast
(ComboBox1.SelectedIndex, Name.personTitle), TextBox1.Text, m.ToArray, TextBox3.Text)
getSex()
Person.PersonSex
(ComboBox2.SelectedIndex, Person.PersonSex)
getDOB()
Date
DateTimePicker1.Value.
addressControl
use
usage
Enum
Display
Edit
shareIndex
Integer
= 0
(
usage,
a
Address)
InitializeComponent()
If
use = usage.Display
Then
PictureBox1.Visible =
False
types()
=
() {Address.AType.PrimaryResidential, Address.AType.SecondaryResidential, Address.AType.PrimaryBusiness, Address.AType.SecondaryBusiness}
ComboBox1.SelectedIndex = Array.IndexOf(types, a.addressType)
ComboBox1.Enabled =
TextBox1.Text = a.addressLine1
TextBox1.
ReadOnly
True
TextBox2.Text = a.addressLine2
TextBox2.
TextBox3.Text = a.town
TextBox3.
TextBox4.Text = a.city
TextBox4.
TextBox5.Text = a.region
TextBox5.
TextBox6.Text = a.postcode
TextBox6.
TextBox7.Text = a.country
TextBox7.
TextBox8.Text = a.landline
TextBox8.
a IsNot
Nothing
shareIndex = a.shareIndex
PictureBox1_Click(
PictureBox1.Click
nl
= Environment.NewLine
response
MsgBoxResult
response = MsgBox(
"Delete this address?"
& nl & nl & _
"Click OK to delete."
& nl & _
"Click Cancel to keep."
, _
MsgBoxStyle.OkCancel
Or
MsgBoxStyle.DefaultButton1
MsgBoxStyle.Question)
response = MsgBoxResult.Ok
x
Me
.Left
.Dispose()
''needs removing from collection
For
Each
c
In
frmMain.Panel5.Controls.OfType(Of addressControl)()
c.Left > x
c.Left -= 360
Next
getAddress()
Address
Address =
Address(
([
].Parse(
GetType
(Address.AType), ComboBox1.Text.Replace(
" "
)), Address.AType), _
TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text, _
TextBox5.Text, TextBox6.Text, TextBox7.Text, TextBox8.Text)
shareIndex > 0
a.shareIndex = shareIndex
ComboBox1.SelectedIndex = 0
OrElse
ComboBox1.SelectedIndex = 1
Label9.Text =
"Address line 1:"
Label10.Text =
"Address line 2:"
ElseIf
ComboBox1.SelectedIndex = 2
ComboBox1.SelectedIndex = 3
"Business name:"
contactsControl
Button2_Click(
Button2.Click
ComboBox1.SelectedIndex = -1
ComboBox1.Items.RemoveAt(ComboBox1.SelectedIndex)
ComboBox1.SelectedIndex = Math.Min(0, ComboBox1.Items.Count - 1)
Button1_Click(
Button1.Click
ComboBox1.Items.Add(TextBox1.Text)
ComboBox1.SelectedIndex = ComboBox1.Items.Count - 1
TextBox1.Text =
ComboBox1.Items.Clear()
ComboBox1.Items.AddRange(p.secondaryPhones.ToArray)
ComboBox2.Items.Clear()
ComboBox2.Items.AddRange(p.emailAddresses.ToArray)
ComboBox2.SelectedIndex = Math.Min(0, ComboBox2.Items.Count - 1)
TextBox2.Text =
getPhoneNumbers()
)(ComboBox1.Items.Cast(Of
).ToArray)
getEmailAddresses()
)(ComboBox2.Items.Cast(Of
Button4_Click(
Button4.Click
ComboBox2.Items.Add(TextBox2.Text)
ComboBox2.SelectedIndex = ComboBox2.Items.Count - 1
Button3_Click(
Button3.Click
ComboBox2.Items.RemoveAt(ComboBox2.SelectedIndex)