Click here to Skip to main content
15,893,622 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Research datagrid using bank.mdb vb.net

Personnel is with a serious problem in trying fzr a research in the datagrid ...preciso to compare three textbox with three columns in the grid and non to getting. Somebody oh it can help me. I already tried of everything more I don't get.

Use banco.mdb for filling the grid
It follows my code oh not this making anything, this code oh it only works if I fill the datagrid without using banco.mdb.
Somebody can tell me the one that this acontencendo!
.....................
"""Pessoal estou com um problema sério em tentar fzr uma pesquisa no datagrid...preciso comparar tres textbox com tres colunas no grid e não to conseguindo. Alguém ai pode me ajudar. Já tentei de tudo mais não consigo.
Uso banco.mdb pra preencher o grid
Segue o meu código ai mais não esta fazendo nada, este código ai só funciona se eu preencher o datagrid sem usar o banco.mdb.
Alguém pode me dizer o que esta acontencendo!"""
......................
VB
For i = 0 To DataGrid1.Rows.Count - 1
    If DataGrid1.Rows(i).Cells(1).Value = textbox1.Text AndAlso _
    DataGrid1.Rows(i).Cells(2).Value = textbox2.Text AndAlso _
    DataGrid1.Rows(i).Cells(3).Value = textbox3.Text Then


    Me.DataGrid1.FirstDisplayedScrollingRowIndex = i
        Me.DataGrid1.Rows(i).Selected = True

        textbox4.Text = RS1.Fields(4).Value
        textbox5.Text = RS1.Fields(5).Value
        textbox6.Text = RS1.Fields(6).Value
        textbox7.Text = RS1.Fields(7).Value


    Else
        textbox4.Text = "?"
        textbox5.Text = "?"
        textbox6.Text = "?"
        textbox7.Text = "?"
    End If
    Exit Sub
Next
Posted
Updated 22-Jan-13 3:07am
v2

1 solution

á got fzr the research, I only had to change some things in the code ...confiram...

For i = 0 To DataGrid1.Rows.Count - 1
If DataGrid1.Rows(i).Cells(1).Value = textbox1.Text.ToString And _
DataGrid1.Rows(i).Cells(2).Value = textbox2.Text.ToString And _
DataGrid1.Rows(i).Cells(3).Value = textbox3.Text.ToString Then

Me.DataGrid1.SelectionMode = DataGridViewSelectionMode.FullRowSelect
Me.DataGrid1.FirstDisplayedScrollingRowIndex = i
Me.DataGrid1.Rows(i).Selected = True
textbox4.Text = DataGrid1.Rows(i).Cells(5).Value

textbox5.Text = DataGrid1.Rows(i).Cells(6).Value
textbox6.Text = DataGrid1.Rows(i).Cells(7).Value
textbox7.Text = DataGrid1.Rows(i).Cells(8).Value
Else
'textbox4.Text = "?"
'textbox5.Text = "?"
'textbox6.Text = "?"
'textbox7.Text = "?"
End If
Exit Sub
Next

It was not easy more I got
My project only lacked this, now this completinho ...ABRAÇOS
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900