求助:参数 1: 无法从“int”转换为“string”

黄粱一梦 2011-05-11 03:02:44
public static Dictionary<int, int> ClusterDict = new Dictionary<int, int>();
private static int config_flag = 0;
private static string config_help;
private static string config_groupnum;
private static string config_grouptalk;
private static string config_grouptalktime;


XmlDocument document = new XmlDocument();
try
{
document.Load("QQRobot.cfg");
config_help = document.SelectSingleNode("config").SelectSingleNode("帮助").InnerText;
config_groupnum = document.SelectSingleNode("config").SelectSingleNode("群号码").InnerText;
config_grouptalk = document.SelectSingleNode("config").SelectSingleNode("机器人自动发言").InnerText;
config_grouptalktime = document.SelectSingleNode("config").SelectSingleNode("自动发言间隔时间").InnerText;
config_help = config_help.Replace("
", "\n");
}
catch
{
EchoHelper.Echo("读取配置文件失败,请按照标准发布配置文件对照检查。", "发送消息", EchoHelper.EchoType.错误信息, qq.QQNumber);
return;
}
if (((int)Convert.ToInt64(config_grouptalktime)) != 0)
{
int num = (int)Convert.ToInt64(config_grouptalktime);
System.Timers.Timer timer = new System.Timers.Timer((double)num);
timer.Elapsed += delegate(object A_0, ElapsedEventArgs A_1)
{
string[] strArray = config_grouptalk.Split(new char[] { '|' });
int maxValue = 0;
for (int j = 0; j < config_grouptalk.Length; j++)
{
if (config_grouptalk[j] == '|')
{
maxValue++;
}
}
Random random = new Random();
string str = strArray[random.Next(0, maxValue)];
SendQunMessage(ClusterDict[(int) Convert.ToInt64(config_groupnum)], "语录:" + str);
config_flag = 1;
};
timer.Start();
}
}

错误行代码是 红色部分的 提示这两个错误 求高手帮助

错误 8 与“QQRobot.QQRobot.SendQunMessage(string, string)”最匹配的重载方法具有一些无效参数 C:\Documents and Settings\Administrator\桌面\Robot2011B\QQRobot\QQRobot.cs 228 21 QQRobot

错误 9 参数 1: 无法从“int”转换为“string” C:\Documents and Settings\Administrator\桌面\Robot2011B\QQRobot\QQRobot.cs 228 36 QQRobot

...全文
859 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
Bo217 2011-05-11
  • 打赏
  • 举报
回复
试试这个:SendQunMessage(ClusterDict[Convert.ToInt32(config_groupnum)].ToString(), "语录:" + str);
  • 打赏
  • 举报
回复
6楼经典
SendQunMessage(ClusterDict[config_groupnum], "语录:" + str);
  • 打赏
  • 举报
回复
ls经典
打酱油 2011-05-11
  • 打赏
  • 举报
回复
SendQunMessage(ClusterDict[Convert.ToInt32(config_groupnum)], "语录:" + str);
relup 2011-05-11
  • 打赏
  • 举报
回复
画蛇这个故事,你也许听说过
wangzhu108 2011-05-11
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 ojlovecd 的回复:]

SendQunMessage(ClusterDict[Convert.ToInt32(config_groupnum)].ToString(), "语录:" + str);
[/Quote]

++
风上人 2011-05-11
  • 打赏
  • 举报
回复
SendQunMessage(ClusterDict[Convert.ToInt32(config_groupnum)], "语录:" + str);
我姓区不姓区 2011-05-11
  • 打赏
  • 举报
回复
SendQunMessage(ClusterDict[Convert.ToInt32(config_groupnum)].ToString(), "语录:" + str);
xiaodru 2011-05-11
  • 打赏
  • 举报
回复
SendQunMessage(ClusterDict[Convert.ToInt32(config_groupnum)], "语录:" + str);
636f6c696e 2011-05-11
  • 打赏
  • 举报
回复
ClusterDict[(int) Convert.ToInt64(config_groupnum)].ToString();

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧