Selected Index

Ok so here we go , as explained before i have a program that has
a textbox that a user enters a run number into if this run number is valid then it will popultate my textboxes and my one combobox accordingly.After my combobox now populated the user selects a value and now i need this combobox to repopulate the textboxes based on
value selected.I know this seems like a really complicated way to do it but where i work this is the only way they permit us to do it.
So come guys help please and thanks in advance.

'Here are my variables for members
'Basically my arraylist gets populated with my infoclass
Private MemberDetail1AL As New ArrayList
Private M01Member001Info As New MPF.PAS.Contributions.M01Member001Info
Private MemberConsInfoController As New MPF.PAS.Contributions.MemberConsInfoController

'here are my variables for industrynumber

Private IndustryReferenceAL As New ArrayList
Private IndustryReferenceInfo As New MPF.PAS.Contributions.M01Member001Info
Private IndustryReferenceController As New MPF.PAS.Contributions.MemberConsInfoController



Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click

''Try RunNumber and if not a valid RunNumber then catch it and show it as an exception

Try

If IsNumeric(Trim(txtRunNumber.Text)) Then

MemberDetail1AL = MemberConsInfoController.GetMemberInfo(txtRunNumber.Text)
M01Member001Info = MemberDetail1AL.Item(0)

End If

Catch ex As Exception
MsgBox("No such Run Number exists, please re-enter a valid Run Number", MsgBoxStyle.Exclamation)
txtRunNumber.Focus()
End Try

'' Here i assign data to my textboxes

txtStatus5.Text = M01Member001Info.StatusCode
txtIdentityNumber3.Text = M01Member001Info.IDNumber
txtDateOfBirth3.Text = M01Member001Info.BirthDate
txtSurname.Text = M01Member001Info.Surname
txtInitials.Text = M01Member001Info.Initials
txtFirstName1.Text = M01Member001Info.FirstName1
txtFirstName2.Text = M01Member001Info.FirstName2
txtFirstName3.Text = M01Member001Info.FirstName3

''combobox is setup

IndustryReferenceAL = IndustryReferenceController.GetMemberInfo(txtRunNumber.Text)
IndustryReferenceInfo = IndustryReferenceAL.Item(0)

With cmbIndustryNumber
.DisplayMember = "Description"
.ValueMember = "IndustryReference"
.DataSource = IndustryReferenceAL
End With

''SelectedIndex event ' i need this combobox that i populated early on
to now when i user selects a value from it repopulate my textboxes

Private Sub cmbIndustryNumber_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbIndustryNumber.SelectedIndexChanged
If cmbIndustryNumber.Text <> "" Then
IndustryReferenceAL = IndustryReferenceController.GetMemberInfo(cmbIndustryNumber.Text)
IndustryReferenceInfo = IndustryReferenceAL.Item(0)

''Need these textboxes to repopulate
txtStatus5.Text = M01Member001Info.StatusCode
txtIdentityNumber3.Text = M01Member001Info.IDNumber
txtDateOfBirth3.Text = M01Member001Info.BirthDate
txtSurname.Text = M01Member001Info.Surname
txtInitials.Text = M01Member001Info.Initials
txtFirstName1.Text = M01Member001Info.FirstName1
txtFirstName2.Text = M01Member001Info.FirstName2
txtFirstName3.Text = M01Member001Info.FirstName3



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories