Hello every one
Please gentelman
How to convert this code with GridView DevExpress
In My Form2 ..
I do my research with TextBox1 and on Click Button1 to display the result with its details in Form1.GridView1
I used this code
- Sub Show_Details_student_category()
- Form1.GridControl1.DataSource = Nothing
- Dim DT As New DataTable
- Dim DA As New OleDb.OleDbDataAdapter("SELECT * From TableStudent Where StudentCode = '" & Me.TextBox1.Text & "' ", Conne)
- DA.Fill(DT)
- If DT.Rows.Count = 0 Then
- MessageBox.Show("Please check the student number", "Avertissement", MessageBoxButtons.OK, MessageBoxIcon.Error)
- Else
- Dim DR = DT.Rows(0)
- Form1.TextBox1.Text = DR!student_code
- Form1.TextBox2.Text = DR!student_Name
- Form1.TextBox3.Text = DR!student_surname
- DA = New OleDb.OleDbDataAdapter("SELECT * From TableStudentCategory Where StudentCategoryCode = '" & Me.TextBox1.Text & "'", Conne)
- Dim DS As New DataSet
- DS = New DataSet
- DA.Fill(DS)
- DT = DS.Tables(0)
- For I = 0 To DT.Rows.Count - 1
-
-
-
-
-
-
-
- Form1.GridView1.AddNewRow()
-
- Form1.GridView1.SetRowCellValue(I).Item(1).Value = DT.Rows(I)("StudentCategoryCode")
- Form1.GridView1.SetRowCellValue(I).Item(1).Value = DT.Rows(I)("StudentCategoryMath")
- Form1.GridView1.SetRowCellValue(I).Cells(2).Value = DT.Rows(I).Item("StudentCategoryHistory")
- Form1.GridView1.SetRowCellValue(I).Cells(3).Value = DT.Rows(I).Item("StudentCategoryLetter")
-
- Next
-
- End If
- Me.Dispose()
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- Show_Details_student_category()
- End Sub
I had errors in these lines :
- Form1.GridView1.SetRowCellValue(I).Item(1).Value = DT.Rows(I)("StudentCategoryCode")
- Form1.GridView1.SetRowCellValue(I).Item(1).Value = DT.Rows(I)("StudentCategoryMath")
- Form1.GridView1.SetRowCellValue(I).Cells(2).Value = DT.Rows(I).Item("StudentCategoryHistory")
- Form1.GridView1.SetRowCellValue(I).Cells(3).Value = DT.Rows(I).Item("StudentCategoryLetter")
Thank you in advance for help
Cordially
M.B