Hi,
I have 2 forms : "Form1" and "Form2"
Form1 have DataGridView (Dgv1), and ContextMenuStrip in it.
DataGridView have 2 Columns : "Code" and "Name"
ContextMenusStrip can do : "Add", "Edit", and "Delete"
Form 2 have 2 TextBoxes : TxtCode, TxtName.
And 2 Buttons : BtnOK, BtnCancel.
Code in Form1 :
Code in Form2 :
At that point, I can do "Add", but I can't do "Edit" and "Delete".
How to open a form that already being Closed or Hided ?
If I input the 1st row : Code = Code1, Name = Jimmy, and Press OK, the 1st row at Dgv1 will be : Code1, and Jimmy.
I'm thinking to search the Form2 based on matching the Code at Dgv1 and Form2.TxtCode.Text.
I was thinking using For Each, but I don't know how is the coding.
Please help me, guys.
Thank you very much.
Regards,
I have 2 forms : "Form1" and "Form2"
Form1 have DataGridView (Dgv1), and ContextMenuStrip in it.
DataGridView have 2 Columns : "Code" and "Name"
ContextMenusStrip can do : "Add", "Edit", and "Delete"
Form 2 have 2 TextBoxes : TxtCode, TxtName.
And 2 Buttons : BtnOK, BtnCancel.
Code in Form1 :
VB.NET:
If I click "Add" on ContextMenuStrip, then :
Dim frForm2 as New Form2
With frForm2
.ShowDialog = Cancel Then Exit Sub
Dgv1.Rows.Add(0, 1)
Dgv1.Rows(0).Cells("Code").Value = .TxtCode.Text.Trim
Dgv1.Rows(0).Cells("Name").Value = .TxtName.Text.Trim
End With
Code in Form2 :
VB.NET:
If I click "BtnOK", then :
Me.DialogResult = OK
Me.Hide or Me.Close (I forget)
If I click "BtnCancel", then :
Me.DialogResult = Cancel
Me.Hide or Me.Close (I forget)
At that point, I can do "Add", but I can't do "Edit" and "Delete".
How to open a form that already being Closed or Hided ?
If I input the 1st row : Code = Code1, Name = Jimmy, and Press OK, the 1st row at Dgv1 will be : Code1, and Jimmy.
I'm thinking to search the Form2 based on matching the Code at Dgv1 and Form2.TxtCode.Text.
I was thinking using For Each, but I don't know how is the coding.
Please help me, guys.
Thank you very much.
Regards,