471,337 Members | 838 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

vb.net 2003: Displaying multiple records....

it's would be simple in Access, but seems to be harder in VB. I want to
enter part of a word and search an access table, and display all instances of
words containing those letters in a box (say a listbox). I can get one word
in, but i can't make it go back and get the others and relist. Can you help?
Here's what i have:

Public Property word() As String
Return m_Word
End Get
Set(ByVal Value As String)
m_Word = Value
End Set
End Property

Public Sub GetWord(ByVal Word As String)
cmdSelect.Parameters("@Word").Value = Word
Dim dr As OleDb.OleDbDataReader
dr = cmdSelect.ExecuteReader
While dr.Read
m_Word = dr("Word")
m_length = dr("Length")
End While

End Sub

Private Sub Find2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Find2.Click
Dim sr As New streamreader("C:\vbprograms\findform\crossword.mdb ")
Dim finished As Boolean = False, line As String

'clean out the listbox first
Display.Items.Clear() 'display is the listbox

m_foundword = New FindWord 'works

' While Not finished
'line = sr.ReadLine
'If line Is Nothing Then
' finished = True
' Else
m_foundword.GetWord(WordFind.Text) 'works
Display.Items.Add(m_foundword.word) 'display is the listbox
' End If
' End While
MessageBox.Show("Done reading!")
End Sub

data connection command text is:
SELECT Dictionary.* FROM Dictionary WHERE (Word LIKE [@WordFind])

thanks you so much for your help!
Jul 21 '05 #1
0 868

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.