0

i have a form that allows the user to add 0 to 4 contact numbers.

Dim ccontact As New Contact
Dim contactId As String = ccontact.getContactid(hcode)


phone1 = cbxPhone1.SelectedItem
phone2 = cbxPhone2.SelectedItem
phone3 = cbxPhone3.SelectedItem
phone4 = cbxPhone4.SelectedItem
tphone1 = txtPhone1.Text
tphone2 = txtPhone2.Text
tphone3 = txtPhone3.Text
tphone4 = txtPhone4.Text

If Not (tphone1 = "") Then
p.fAddPhoneNumber(contactId, phone1, tphone1)
ElseIf Not (tphone2 = "") Then
p.fAddPhoneNumber(contactId, phone1, tphone1)
p.fAddPhoneNumber(contactId, phone2, tphone2)
ElseIf Not (tphone3 = "") Then
p.fAddPhoneNumber(contactId, phone1, tphone1)
p.fAddPhoneNumber(contactId, phone2, tphone2)
p.fAddPhoneNumber(contactId, phone3, tphone3)
ElseIf Not (tphone4 = "") Then
p.fAddPhoneNumber(contactId, phone1, tphone1)
p.fAddPhoneNumber(contactId, phone2, tphone2)
p.fAddPhoneNumber(contactId, phone3, tphone3)
p.fAddPhoneNumber(contactId, phone4, tphone4)
End If

above is my code, it does not look right, any suggestions guys?

1
Contributor
1
Reply
2
Views
9 Years
Discussion Span
Last Post by jalandoonk
0

i have a form that allows the user to add 0 to 4 contact numbers.

Dim ccontact As New Contact
Dim contactId As String = ccontact.getContactid(hcode)


phone1 = cbxPhone1.SelectedItem
phone2 = cbxPhone2.SelectedItem
phone3 = cbxPhone3.SelectedItem
phone4 = cbxPhone4.SelectedItem
tphone1 = txtPhone1.Text
tphone2 = txtPhone2.Text
tphone3 = txtPhone3.Text
tphone4 = txtPhone4.Text

If Not (tphone1 = "") Then
p.fAddPhoneNumber(contactId, phone1, tphone1)
ElseIf Not (tphone2 = "") Then
p.fAddPhoneNumber(contactId, phone1, tphone1)
p.fAddPhoneNumber(contactId, phone2, tphone2)
ElseIf Not (tphone3 = "") Then
p.fAddPhoneNumber(contactId, phone1, tphone1)
p.fAddPhoneNumber(contactId, phone2, tphone2)
p.fAddPhoneNumber(contactId, phone3, tphone3)
ElseIf Not (tphone4 = "") Then
p.fAddPhoneNumber(contactId, phone1, tphone1)
p.fAddPhoneNumber(contactId, phone2, tphone2)
p.fAddPhoneNumber(contactId, phone3, tphone3)
p.fAddPhoneNumber(contactId, phone4, tphone4)
End If

above is my code, it does not look right, any suggestions guys?

---------changed part of my code and added a question---------------

i have a form that allows the user to add 0 to 4 contact numbers.

If tphone4 = "" And tphone3 = "" And tphone2 = "" And tphone1.Length > 0 Then
p.fAddPhoneNumber(contactId, phone1, tphone1)

ElseIf tphone4 = "" And tphone3 = "" And tphone2.Length > 0 And tphone1.Length > 0 Then
p.fAddPhoneNumber(contactId, phone1, tphone1)
p.fAddPhoneNumber(contactId, phone2, tphone2)

ElseIf tphone4 = "" And tphone3.Length > 0 And tphone2.Length > 0 And tphone1.Length > 0 Then
p.fAddPhoneNumber(contactId, phone1, tphone1)
p.fAddPhoneNumber(contactId, phone2, tphone2)
p.fAddPhoneNumber(contactId, phone3, tphone3)

Else
p.fAddPhoneNumber(contactId, phone1, tphone1)
p.fAddPhoneNumber(contactId, phone2, tphone2)
p.fAddPhoneNumber(contactId, phone3, tphone3)
p.fAddPhoneNumber(contactId, phone4, tphone4)
End If

above is my code. I just want to add the phone number if the text box(es) and dropdown box(es) ONLY has a data in it. also my code does not look right, any suggestions guys?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.