在vb.net中使用mshflexgrid时出错 [英] Error using mshflexgrid in vb.net

查看:62
本文介绍了在vb.net中使用mshflexgrid时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我们根据显示的日期和日期在文本框中发布天数.默认情况下,起始日期"是系统日期.该报告需要根据文本框中发布的天数来生成列.但是在将运行时日期添加到mshflexgrid标头列时出现错误.

它正在生成列,但最后一列正在生成错误

有人可以帮我解决这个问题吗?

非常感谢..
Prera​​na

错误是:来自HRESULT的异常:0x800A017D(CTL_E_INVALIDPROPERTYARRAYINDEX)
此错误在循环的最后一次显示.
以下是代码:



We post number of days in the text box based on which from date and to date are displayed. From Date is by default the system date. The report needs to generate columns based on the no of days posted in the text box. But I am getting error while adding date at runtime to mshflexgrid header column.

It is generating the columns but the last column is generating an error

Can anybody help me to resolve this please.

Thank you very much..
Prerana

the error is : Exception from HRESULT: 0x800A017D (CTL_E_INVALIDPROPERTYARRAYINDEX)
this error is displaying at the last time of loop.
The following is the code:

If i = 3 Then
                        fdate = DateTimePicker1.Value.ToString("MM/dd/yyyy HH:mm:ss tt")
                        sdate = DateTimePicker1.Value.ToString("dd-MM-yyyy")
                        .set_TextMatrix(0, i, sdate)
                    ElseIf i > 3 And i < 34 Then
                        If rbtDaily.Checked = True Then
                            j = 1
                            ndate = (Now.AddDays(j).ToString("MM/dd/yyyy HH:mm:ss tt"))
                            sdate = Now.AddDays(j).ToString("dd-MM-yyyy")
                            '.set_ColWidth(i, 1000) ': .get_GridLinesHeader("'" & ndate & "'")
 error at this line:        .set_TextMatrix(0, i, sdate)
                        ElseIf rbtWeekly.Checked = True Then
                            ndate = DateValue(Now.AddDays(6).ToString("MM/dd/yyyy HH:mm:ss tt"))
                            sdate = Now.AddDays(6).ToString("dd-MM-yyyy")
                            .set_TextMatrix(0, i, sdate)
                        ElseIf rbtMonthly.Checked = True Then
                            j = 1
                            ndate = DateValue(Now.AddMonths(j).ToString("MM/dd/yyyy HH:mm:ss tt"))
                            sdate = Now.AddDays(j).ToString("dd-MM-yyyy")
                            ' tdate = ndate
                            .set_TextMatrix(0, i, sdate)
                        End If

推荐答案

我没有诚实地阅读完整的代码,但是看着错误我可以给你一个建议.边界条件出了点问题.也许是最后的记录.或您正在使用的集合似乎比您在代码中指定的少了一个项目.只需在到达最后一列时检查"i"的值即可.
I did not read the complete code (honestly) but looking at the error I could give you one suggestion. something is going wrong on boundary condition. Perhaps the last record. or it seems the collection that you are using has one less item than you are specifying in code. just check the value of "i" when it hits the last column.


这篇关于在vb.net中使用mshflexgrid时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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