本人基于对话框的程序中加入以个combobox控件,combobox的数据是COM1和COM2。 combobox数据默认时com1。想不明白啊,求各位大侠指教!!
void CSCommTestDlg::OnSelchangeCOMBOserialport()
{
// TODO: Add your control notification handler code here
//MessageBox("port will be changed");
CString serialport;
m_ctrl_port.GetWindowText(serialport);
m_strTXData+=serialport;
UpdateData(false);//在编辑框中显示
}数据选了com2但还是显示数据com1,想不明白啊,求各位大侠指教!!
void CSCommTestDlg::OnSelchangeCOMBOserialport()
{
// TODO: Add your control notification handler code here
//MessageBox("port will be changed");
CString serialport;
m_ctrl_port.GetWindowText(serialport);
m_strTXData+=serialport;
UpdateData(false);//在编辑框中显示
}数据选了com2但还是显示数据com1,想不明白啊,求各位大侠指教!!
你用SetWindowText()试试,看是不是UpdateData(false);的位置原因
m_ctrl_port.GetLBText(m_ctrl_port.GetCurSel(), strSerialPort);
m_ctrl_port.GetLBText(m_ctrl_port.GetCurSel(), strSerialPort);
m_strTXData += serialport;
UpdateData(FALSE);