Click here to Skip to main content
15,896,348 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Image Editing Problems Pin
Mazitan16-Nov-05 2:42
Mazitan16-Nov-05 2:42 
QuestionStretching BackgroundImage Pin
eagertolearn15-Nov-05 12:07
eagertolearn15-Nov-05 12:07 
AnswerRe: Stretching BackgroundImage Pin
Christian Graus15-Nov-05 12:53
protectorChristian Graus15-Nov-05 12:53 
GeneralRe: Stretching BackgroundImage Pin
eagertolearn15-Nov-05 16:08
eagertolearn15-Nov-05 16:08 
QuestionMatrix Transformations before rendering Pin
K. Shaffer15-Nov-05 8:43
K. Shaffer15-Nov-05 8:43 
Questiondisplaying search results Pin
JMS7615-Nov-05 7:07
JMS7615-Nov-05 7:07 
AnswerRe: displaying search results Pin
Guerven15-Nov-05 14:44
Guerven15-Nov-05 14:44 
GeneralRe: displaying search results Pin
JMS7616-Nov-05 5:55
JMS7616-Nov-05 5:55 
Here is the code for the btnSearch_Click event and then for the lstResults_SelectedIndexChanged event. I believe it is something w/in these sections. My opinion on the problem is that I am using a string in the lstResults_SelectedIndexChanged event and there is nothing to tie the search results with the actual records (unique ID). I don't know if I am wording this right but I somehow need to tie my search results into a unique ID (Primary Key of dB). Anyway, here is the code:

Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
'search the dataset for the record
Dim TotalRows As Integer

TotalRows = dsCards.Tables("Football Cards").Rows.Count

'if they have no active DataSet, refuse:

If dsCards.Tables.Count = 0 Then
MsgBox("please use the File menu to open a Dataset, or create a new one first.")
Exit Sub
End If

'search for the target, then display it

Dim searchfor As String = InputBox("Enter Your Search Term", "Search")
If searchfor.Length = 0 Then
Return
End If

lstResults.Items.Clear()

Dim i, x, count As Integer

For i = 0 To TotalRows - 1
x = dsCards.Tables("Football Cards").Rows(i).Item(8).ToString.ToUpper.IndexOf(searchfor.ToUpper) ' see if title column matches
If x <> -1 Then 'match
lstResults.Items.Add(dsCards.Tables("Football Cards").Rows(i).Item(8))
'add title field to listbox
count += 1
End If
Next i

If count = 0 Then 'no matches found
MsgBox("No match for " & searchfor & " was found...")
Else
lstResults.Visible = True
End If

End Sub

Private Sub lstResults_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstResults.SelectedIndexChanged
'go to the selected record
Dim dr As DataRow, dt As DataTable

lstResults.Visible = False

Dim i As Integer = 0
Dim s As String

dt = dsCards.Tables("Football Cards")

s = lstResults.SelectedItem.ToString 'which item did they click?

'find their choice

For Each dr In dt.Rows 'search the dataset to find the correct Description

dr = dsCards.Tables("Football Cards").Rows(i)

i = i + 1
If dr(8).ToString = s Then
bmCards.Position = i - 1
Exit For
End If
Next

End Sub

Thank you!
jason

I'd rather have a bottle in front of me than a frontal lobotomy.
QuestionReferencing the selected ro in a DataGrid Pin
dptalt15-Nov-05 6:51
dptalt15-Nov-05 6:51 
AnswerRe: Referencing the selected ro in a DataGrid Pin
Guerven15-Nov-05 14:47
Guerven15-Nov-05 14:47 
AnswerRe: Referencing the selected ro in a DataGrid Pin
aseef15-Nov-05 21:45
aseef15-Nov-05 21:45 
GeneralRe: Referencing the selected ro in a DataGrid Pin
dptalt17-Nov-05 2:12
dptalt17-Nov-05 2:12 
QuestionCombobox issues Pin
lildragon15-Nov-05 6:36
lildragon15-Nov-05 6:36 
QuestionDisable the Windows Key Pin
Wilhelm-NA15-Nov-05 4:07
Wilhelm-NA15-Nov-05 4:07 
AnswerRe: Disable the Windows Key Pin
Dave Kreskowiak15-Nov-05 6:25
mveDave Kreskowiak15-Nov-05 6:25 
QuestionCSV file Pin
Dennis Huisman15-Nov-05 3:19
Dennis Huisman15-Nov-05 3:19 
AnswerRe: CSV file Pin
Christian Graus15-Nov-05 12:54
protectorChristian Graus15-Nov-05 12:54 
GeneralRe: CSV file Pin
Dennis Huisman15-Nov-05 19:16
Dennis Huisman15-Nov-05 19:16 
GeneralRe: CSV file Pin
Christian Graus16-Nov-05 12:15
protectorChristian Graus16-Nov-05 12:15 
QuestionHow to do Pin
minhbt_hitec15-Nov-05 2:50
minhbt_hitec15-Nov-05 2:50 
AnswerRe: How to do Pin
Christian Graus15-Nov-05 12:53
protectorChristian Graus15-Nov-05 12:53 
QuestionLast Post apply to VB.NET 2003 Pin
PatriceB15-Nov-05 1:58
PatriceB15-Nov-05 1:58 
QuestionStrong Name: error BC30145 Pin
PatriceB15-Nov-05 1:50
PatriceB15-Nov-05 1:50 
Questiontoolbar button , How on disable Normal image will display Pin
Rizwan Bashir15-Nov-05 1:20
Rizwan Bashir15-Nov-05 1:20 
Questionfile content change notification in VB Pin
Dinakara K15-Nov-05 1:19
Dinakara K15-Nov-05 1:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.