| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 403 人关注过本帖
标题:怎么办?
只看楼主 加入收藏
china25qd
Rank: 1
等 级:新手上路
帖 子:161
专家分:0
注 册:2007-9-6
收藏
 问题点数:0 回复次数:3 
怎么办?

我要把一个文本框里输入的信息通过按钮转移到另一个文本筐里:
void CMy20070907_wuDlg::OnBtnand() //"And"
{
// TODO: Add your control notification handler code here
CString str;
m_Txtinput.GetWindowText(str);
m_Txtinput.SetWindowText(str + CString("&"));

}

void CMy20070907_wuDlg::OnBtnimp() // "->"
{
// TODO: Add your control notification handler code here
CString str;
m_Txtinput.GetWindowText(str);
m_Txtinput.SetWindowText(str + CString("->"));

}

void CMy20070907_wuDlg::OnBtnminus() //"-"
{
// TODO: Add your control notification handler code here
CString str;
m_Txtinput.GetWindowText(str);
m_Txtinput.SetWindowText(str + CString("-"));

}

void CMy20070907_wuDlg::OnBtnor() // "||"
{
// TODO: Add your control notification handler code here
CString str;
m_Txtinput.GetWindowText(str);
m_Txtinput.SetWindowText(str + CString("||"));

}

void CMy20070907_wuDlg::OnChangeTxtInput()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.

// TODO: Add your control notification handler code here

}

void CMy20070907_wuDlg::OnbtnEnt() //">>"
{
// TODO: Add your control notification handler code here
CString str1, str2;
m_Editcondition.GetWindowText(str2);
m_Editcondition.SetWindowText(str2 + m_Txtinput.GetWindowText(str1));
}

然后error中说:error C2679: binary '+' : no operator defined which takes a right-hand operand of type 'void' (or there is no acceptable conversion)
怎么办呢?

搜索更多相关主题的帖子: 怎么办 信息 control 文本框 
2007-09-13 20:46
海子星竹
Rank: 1
等 级:新手上路
威 望:1
帖 子:58
专家分:0
注 册:2007-9-4
收藏
得分:0 

合并字符串是不能用加减号的
用strcat来连接两个字符串

2007-09-14 12:18
PcrazyC
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:5652
专家分:0
注 册:2006-10-20
收藏
得分:0 
你去查下MSDN,看看GetWindowText的返回值是什么就知道了,将这一句换成两句:

m_Txtinput.GetWindowText(str1);
m_Editcondition.SetWindowText(str2 + str1);

雁无留踪之意,水无取影之心
2007-09-14 18:29
china25qd
Rank: 1
等 级:新手上路
帖 子:161
专家分:0
注 册:2007-9-6
收藏
得分:0 

谢谢楼上


抱膝怀天下 闲坐观四海
2007-09-14 21:43
快速回复:怎么办?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023872 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved