hello everybody,
<first of all i am sorry if i have already submitted similar thread, because i wasnt sure whether this thread has been submitted since i was redirected to the login page>
i am working on a project on .net CF using VB. in my project, i have a datagrid which is bind it to a datasource as below (in form activated):
ds = Globall.ReadXML .ReadStudentXML <-- reading from a class
With DataGrid1
.DataSource = ds.Tables("stud ent")
.DataBindings.C lear()
.DataBindings() .Add("Text", .DataSource, "StudID")
then in my mouseUp event, where i click on a row header in the datagrid, i would want to filter the row according to the primary key and display only the row's information to some label controls. i did a filter and some data binding to label as below :
With DataGrid1
If .HitTest(e.X, e.Y).Type = HitTestType.Row Header Then
ds.Tables("stud ent").DefaultVi ew.RowFilter = "StudID= ' " &DataGrid1.T ext & "' " <--- this is the primary key that i bind to the datagrid earlier i (i am not sure whether this is correct)
lblID.DataBindi ngs.Add("Text", ds.Tables("stud ent"), "StudID")
lblName.DataBin dings.Add("Text ",ds.Tables("st udent"), "StudName")
lblClass.DataBi ndings.Add("Tex t",ds.Tables("s tudent"), "Class")
End If
End With
This code works fine for the the few rows of the datagrid. But when i select the 5th row of the datagrid, it throws the exception "ArgumentExcept ion"
I am confused as to what happened. i tried several other ways, such as putting the lbl.databinding s in the form activated, but it returned the ArgumentOutOfRa nge Exception.
i suspect the problem came from this line :
ds.Tables("stud ent").DefaultVi ew.RowFilter = "StudID= ' " &DataGrid1.T ext & "' "
but i dont know how to fix it nor i see anything wrong with it.. Please help to give advise.. i've been working on this for two days, and yet i dont know what is wrong with it.
fyi : what i want to do is just access the value on the datagrid, instead of the value in the underlying datasource object and display it on the label control.
Hope someone could help.. Thanks in advance
regards,
Zoe
<first of all i am sorry if i have already submitted similar thread, because i wasnt sure whether this thread has been submitted since i was redirected to the login page>
i am working on a project on .net CF using VB. in my project, i have a datagrid which is bind it to a datasource as below (in form activated):
ds = Globall.ReadXML .ReadStudentXML <-- reading from a class
With DataGrid1
.DataSource = ds.Tables("stud ent")
.DataBindings.C lear()
.DataBindings() .Add("Text", .DataSource, "StudID")
then in my mouseUp event, where i click on a row header in the datagrid, i would want to filter the row according to the primary key and display only the row's information to some label controls. i did a filter and some data binding to label as below :
With DataGrid1
If .HitTest(e.X, e.Y).Type = HitTestType.Row Header Then
ds.Tables("stud ent").DefaultVi ew.RowFilter = "StudID= ' " &DataGrid1.T ext & "' " <--- this is the primary key that i bind to the datagrid earlier i (i am not sure whether this is correct)
lblID.DataBindi ngs.Add("Text", ds.Tables("stud ent"), "StudID")
lblName.DataBin dings.Add("Text ",ds.Tables("st udent"), "StudName")
lblClass.DataBi ndings.Add("Tex t",ds.Tables("s tudent"), "Class")
End If
End With
This code works fine for the the few rows of the datagrid. But when i select the 5th row of the datagrid, it throws the exception "ArgumentExcept ion"
I am confused as to what happened. i tried several other ways, such as putting the lbl.databinding s in the form activated, but it returned the ArgumentOutOfRa nge Exception.
i suspect the problem came from this line :
ds.Tables("stud ent").DefaultVi ew.RowFilter = "StudID= ' " &DataGrid1.T ext & "' "
but i dont know how to fix it nor i see anything wrong with it.. Please help to give advise.. i've been working on this for two days, and yet i dont know what is wrong with it.
fyi : what i want to do is just access the value on the datagrid, instead of the value in the underlying datasource object and display it on the label control.
Hope someone could help.. Thanks in advance
regards,
Zoe
Comment