startindex不能大于字符串的长度.参数名称startindex [英] startindex cannot be larger than length of string. parameter name startindex

查看:1893
本文介绍了startindex不能大于字符串的长度.参数名称startindex的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.net我是.net中的新手.
我使用devexpress 11.1中的gridcontrol
我的代码可以显示行,但是当我尝试在gridview中编辑值时,会出错..
我不明白,为什么在我的Visual Studio 2010中我看不到错误..但是当我创建到setup.exe(部署项目)时.我得到这个错误? :(

http://s17.postimage.org/pay89wyan/griderror.png [

hai i''m newbie in .net.
i use gridcontrol from devexpress 11.1
my code can display row but when i try to edit value in gridview, it make error..
i don''t understand, why in my visual studio 2010, i can''t get error..but when i create to setup.exe (deployment project). i get this error?? :(

http://s17.postimage.org/pay89wyan/griderror.png[^]

this my code to set gridview

GridControl2.DataSource = GetDataSource()
        With GridView2
            .Columns("ItemPrice").DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            .Columns("ItemPrice").DisplayFormat.FormatString = "c0"
            .Columns("ItemDisc").DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            .Columns("ItemDisc").DisplayFormat.FormatString = "c0"
            .RefreshData()
        End With




需要帮助... thx:)




need help...thx :)

推荐答案

这不是很明显吗?当然,大于长度的起始索引可能没有意义.

现在,关于修复它……这不在您显示的代码中.查找对String.Substring的呼叫.但是,这种方法是错误的.在调试器上运行它;它会向您显示引发异常的确切位置.

—SA
Isn''t this obvious? Of course, a starting index larger than the length could not possibly make sense.

Now, about fixing it… This is not in the code you show. Look for the call to String.Substring. However, the approach is wrong. Run it under debugger; it will show you exact point where the exception was thrown.

—SA


这篇关于startindex不能大于字符串的长度.参数名称startindex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆