Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
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!"""
......................
        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 22-Jan-13 2:39am
Edited 22-Jan-13 3:07am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

á 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
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 489
1 ChintanShukla 295
2 RyanDev 250
3 Richard Deeming 250
4 Sergey Alexandrovich Kryukov 218
0 Sergey Alexandrovich Kryukov 8,906
1 OriginalGriff 7,601
2 CPallini 2,603
3 Richard MacCutchan 2,121
4 Abhinav S 1,923


Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 22 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100