M
Miro
VB 2005 express...
I created a database "Staff" and it has 1 table in it.
There are 3 columns in it so far.
"StaffID" -> INT - Primary Key auto incremented by 1
"FirstName" - Varchar
"LastName" - varchar
( there will be more later - but baby steps )
Then I created 2 forms.
Form1 is the main form where I dragged the datagrid to the form.
Now I made the Datagrid.SelectionMode = FullRowSelect
and the datagrid is not editable.
Now On Form2 I created a property that is going to store the "StaffID"
This form I am going to try to code all "without a wizard".
====
Dim iStaffMember As Integer = ""
Public Property StaffMember() As Integer
Get
Return iStaffMember
End Get
Set(ByVal Value As Integer)
iStaffMember = Value
End Set
End Property
===
So now back on Form1 right before I try to "Form2.SHOW()" I try to set
that property from the datagrid so i can do my "own select" statement in
form 2 to show the detail's of the data.
( Example like: Select * from Staff where StaffID = StaffMemberProperty )
But I just cant seem to get the property set correctly
Dim fStaffMember as New Form2
fStaffMember.StaffMember =
Me.StaffDataSet.Staff.Rows(Me.StaffDataGridView.CurrentCell.RowIndex)("StaffID")
first off, the CurrentCell.RowIndex is incorrect - since I allow
resorting by column, its actually not the correct index from the dataset.
2nd, I get a convert error.
What is the parameter I should be using to get the "row#" from the bound
dataset?
And what Datatype should by Property be dim'd as?
Thanks
Miro
I created a database "Staff" and it has 1 table in it.
There are 3 columns in it so far.
"StaffID" -> INT - Primary Key auto incremented by 1
"FirstName" - Varchar
"LastName" - varchar
( there will be more later - but baby steps )
Then I created 2 forms.
Form1 is the main form where I dragged the datagrid to the form.
Now I made the Datagrid.SelectionMode = FullRowSelect
and the datagrid is not editable.
Now On Form2 I created a property that is going to store the "StaffID"
This form I am going to try to code all "without a wizard".
====
Dim iStaffMember As Integer = ""
Public Property StaffMember() As Integer
Get
Return iStaffMember
End Get
Set(ByVal Value As Integer)
iStaffMember = Value
End Set
End Property
===
So now back on Form1 right before I try to "Form2.SHOW()" I try to set
that property from the datagrid so i can do my "own select" statement in
form 2 to show the detail's of the data.
( Example like: Select * from Staff where StaffID = StaffMemberProperty )
But I just cant seem to get the property set correctly
Dim fStaffMember as New Form2
fStaffMember.StaffMember =
Me.StaffDataSet.Staff.Rows(Me.StaffDataGridView.CurrentCell.RowIndex)("StaffID")
first off, the CurrentCell.RowIndex is incorrect - since I allow
resorting by column, its actually not the correct index from the dataset.
2nd, I get a convert error.
What is the parameter I should be using to get the "row#" from the bound
dataset?
And what Datatype should by Property be dim'd as?
Thanks
Miro