输入字符串的格式不正确怎么解决啊 #C

wy3792 wy3792 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
未处理 System.FormatException
Message="输入字符串的格式不正确。"
Source="mscorlib"
StackTrace:
在 System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
在 System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
在 System.Int32.Parse(String s)
在 P2PExample.FormP2P.timerSecond_Tick(Object sender, EventArgs e) 位置 G:\网络通信\P2PExample\P2PExample\FormP2P.cs:行号 279
在 System.Windows.Forms.Timer.OnTick(EventArgs e)
在 System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
在 System.Windows.Forms.Application.Run(Form mainForm)
在 P2PExample.Program.Main() 位置 G:\网络通信\P2PExample\P2PExample\Program.cs:行号 18
在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()
InnerException:



代码如下:
private void timerSecond_Tick(object sender, EventArgs e)
{
if(secondWatch.ElapsedMilliseconds/1000==int.Parse(textBoxTimeInterval.Text))---这一行报错
{
textBoxTimerStatus.Text = "刷新";
timerSecond.Stop();
secondWatch.Reset();
for (int i = 0; i < listViewMyFriend.Items.Count; i++)
{
string remoteIpString = listViewMyFriend.Items[i].SubItems[0].Text;
string remotePortString = listViewMyFriend.Items[i].SubItems[1].Text;
SendMessage(remoteIpString, remotePortString, "check", "看看你还在没?");
}
timerSecond.Start();
secondWatch.Start();
}
else
{
textBoxTimerStatus.Text = string.Format("{0}", secondWatch.ElapsedMilliseconds / 1000);
}
}
...全文

相关推荐

小网站 #C ASP.NET

小网站 15张网页 对数据库 插入 删除 更新操作

romankingtao

统计从键盘所输入字符的中英文字母的个数.zip

《C#程序设计项目教程》,书本94面,统计从键盘所输入的中英文字符个数。 统计从键盘输入的一行字符中,中文、英文、数字字符的字数。

Burgundy Red

js行号显示的文本框实现效果(兼容多种浏览器 )

本文主要介绍了javascript实现行号显示的文本框效果,这样就可以解决读者很难迅速找到所在某一行的对应代码,感兴趣的小伙伴们可以参考一下

weixin_38746818

c#操作数据库并导出数据为csv格式(自己记录学习用)

自己记录一下,方便后来查找,自己记录一下,方便后来查找,自己记录一下,方便后来查找,自己记录一下,方便后来查找,自己记录一下,方便后来查找,

DenggLin

LeetCode判断字符串是否循环-leetcode:每天做leetCode的题,每天努力学习。学习使我进步,学习使我快乐学习

LeetCode判断字符串是否循环 leetcode Do the questions in leetCode every day, and study hard every day. Learning makes me progress, learning makes me happy to learn #2019/11/20 今天第一次上传,主要使记录leetcode刷题,为了自己梦想前进 leetcode 09 判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。 整体思路: 1、如果是负数直接返回false 2、如果是大于等于0的数 1、获取最后一位 利用取余数 2、将结果加上这个余数 3、将该数除以10若概数大0 结果乘10继续循环 #leetcode 09 #罗马数字包含以下七种字符: I, V, X, L,C,D 和 M。 # #字符 数值 #I 1 #V 5 #X 10 #L 50 #C 100 #D 500 #M 1000 #例如, 罗马数字 2 写做 II ,即为两个并列的 1。12 写做 XII ,即为 X + II 。

weixin_38680506
评论 6
收藏 已收藏
分享
返回顶部
wy3792
C# 111,129 成员 642,538 内容