trouble with .find statement

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

hey

here's the problem. it is for an assignment.

i have this code.

Private Sub cmdGetIt_Click()
adoprez.Recordset.MoveFirst
adoprez.Recordset.Find "Name = " & lstName.Text, ,
adSearchForward
If adoprez.Recordset.EOF = True Then
adoprez.Recordset.MoveFirst
imgPortrait.Picture = LoadPicture(txtImgLocate)
End If
imgPortrait.Visible = True
imgPortrait.Picture = LoadPicture(txtImgLocate)
End Sub

basically im trying to allow the user to click on any name
from the list box and click the find button. the picture
wont load and there is something wrong with the find
segment. help?
 
Chris said:
hey

here's the problem. it is for an assignment.

i have this code.

Private Sub cmdGetIt_Click()
adoprez.Recordset.MoveFirst
adoprez.Recordset.Find "Name = " & lstName.Text, ,
adSearchForward
If adoprez.Recordset.EOF = True Then
adoprez.Recordset.MoveFirst
imgPortrait.Picture = LoadPicture(txtImgLocate)
End If
imgPortrait.Visible = True
imgPortrait.Picture = LoadPicture(txtImgLocate)
End Sub

basically im trying to allow the user to click on any name
from the list box and click the find button. the picture
wont load and there is something wrong with the find
segment. help?

Looks like VB6 code. As this is a VB.NET group, please turn to
microsoft.public.vb.*
 
Hello,

Chris said:
here's the problem. it is for an assignment.

i have this code.

Private Sub cmdGetIt_Click()
adoprez.Recordset.MoveFirst
adoprez.Recordset.Find "Name = " & lstName.Text, ,
adSearchForward
If adoprez.Recordset.EOF = True Then

Better:

\\\
If adoprez.Recordset.EOF Then
///
adoprez.Recordset.MoveFirst
imgPortrait.Picture = LoadPicture(txtImgLocate)

Better:

\\\
Set imgPortrait.Picture = LoadPicture(txtImgLocate)
///
End If
imgPortrait.Visible = True
imgPortrait.Picture = LoadPicture(txtImgLocate)
End Sub

basically im trying to allow the user to click on any name
from the list box and click the find button. the picture
wont load and there is something wrong with the find
segment. help?

This is a VB.NET ng. I suggest you post your question to one of the VB
Classic ngs (microsoft.public.vb.*).

HTH,
Herfried K. Wagner
 
Back
Top