Here is your improved code:
void CSerialTestDlg::SetGainData()
{
CString cstr="";
CString cstrB="";
CString cstrC="";
Edit_VGain.GetWindowTextA(cstr);
Edit_AGain.GetWindowTextA(cstrB);
Edit_BoardID.GetWindowTextA(cstrC);
}
Does exactly the same as far as I can see.