1
It's a syntax for C# - translate into VB I think.
Did You use mouse event on DataGrid? Sender should be DataGrid. Check it.
1
Thank you for you reply. But I still can not solved the problem because of syntax errors (DataGrid)sender.
I create a frmCustomer that contains of txtCustID, txtCustFName,txtCustLName,txtCustDob and txtCustIC.... and the Add button, Search button and Exit button. When the user click on the Search button, the frmSearch will show. The user can search for the customer by select the alphabet in a combobox. The details of the customer whose last name start with that alphabet will display in the datagrid.
The datagrid in ths frmSearch contains of CustID, CustName, CustDoB. When the user double click on the specific row of the datagrid. It will retrieve the records from the Customer table in SQL server by passing the CustID and display the CustID, CustFName, CustLName, CustDob, CustIC.... to the txtCustID, txtCustFName,txtCustLName,txtCustDob and txtCustIC....on the frmCustmer. Then, the user can do the edit or delete of the record by pressing the button.
Please help me in solving the above problem.
vivsm
I have solved the problems in question 2. thank for your help
Thanks and best regards,
vi

1
Try using something like the following in the mouse_down event of datagrid: (pls excuse syntax errors if any)
DataGrid myGrid = (DataGrid)sender;
System.Windows.Forms.DataGrid.HitTestInfo hti;
hti = myGrid.HitTest(e.X, e.Y);
if (hti.Type == System.Windows.Forms.DataGrid.HitTestType.Cell) and (e.Clicks ==2)
{
//your code, e.g. myRowNo = hti.Row;
}
For question2, maybe use Substring, e.g. ICNo.Substring(3, 2) will return "06"