By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,528 Members | 1,338 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,528 IT Pros & Developers. It's quick & easy.

Passing data between forms...

P: n/a
Help I've got a problem !

What I'm trying to do is in one event procedure in Form A
is to search an array list class for a match on one
element and display the results on Form B

I've got a similar but slightly more complex function
working perfectly inside Form A which goes something like


Private Sub cmdSearch_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) _
Handles cmdSearch.Click

Dim tempAlbum As New Album_Class

Select Case True
Case Me.cmbSearchOn.SelectedItem = "Genre"
For Each tempAlbum In myMusic
If tempAlbum.Genre =
Me.txtSearchCriteria.Text Then
Call display(tempAlbum)
End If
Next tempAlbum

end sub

Private Sub display(ByRef tempAlbum)

cmbGenre.SelectedItem = tempAlbum.Genre
txtAlbumName.Text = tempAlbum.AlbumName
txtArtistName.Text = tempAlbum.ArtistName
txtRecordLabel.Text = tempAlbum.RecordLabel
txtYear.Text = tempAlbum.Year

end sub


^^^This simply searches the arraylist and display the
result as you would expect. However this one which is
trying to work between the 2 forms refuses to display any


Private Sub txtArtistName_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) _
Handles txtArtistName.DoubleClick

Dim tempArtist As New Artist_Class

For Each tempArtist In myArtists
If tempArtist.ArtistName =
Me.txtArtistName.Text Then
Call display_artist(tempArtist)
End If
Next tempArtist

End Sub
Private Sub display_artist(ByRef tempArtist)

objArtistForm.txtSingerName.Text =
objArtistForm.txtDateOfBirth.Text =
objArtistForm.txtDateOfDeath.Text =
objArtistForm.txtBiography.Text =

End Sub


Can anyone see anything blatantly obvious that I might be
doing wrong ??
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a

Ok just to narrow it down a bit for you guy's I dumped
the event procedure onto the second form and performed
the search on the arraylist that way and it does produce
the desired results, so my classes must be set properly
with correct names etc. So there definetly seems to be a
problem with passing it between the forms...
Nov 20 '05 #2

P: n/a
Finally figured this one out myself the value was
definetly getting lost between the forms, so what I done
was simply passed the value to the form through a
variable and performed the search on the arraylist
automatically in the form B's load event if a specific
criteria was met - easy when you know how, highly
distressing when you don't

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.