TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mada Black
NA
67
3.1k
Convert value From DataGridView to GridView Dev Express
Mar 30 2020 5:16 AM
Hello every one
Please gentelman
H
ow 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.DataGridView1.Rows.Add()
'Form1.DataGridView1.Rows(I).Cells(1).Value = DT.Rows(I).Item("StudentCategoryCode")
'Form1.DataGridView1.Rows(I).Cells(2).Value = DT.Rows(I).Item("StudentCategoryMath")
'Form1.DataGridView1.Rows(I).Cells(3).Value = DT.Rows(I).Item("StudentCategoryHistory")
'Form1.DataGridView1.Rows(I).Cells(4).Value = DT.Rows(I).Item("StudentCategoryLetter")
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
Reply
Answers (
3
)
Asp.Net web application
Show only limited charcater.