Index was out of range. Must be non-negative and less than the size of the collection.

asp.net , vb.net , sql server India
  • 12 years ago
    Plz solve my problem code is... singlecourse = Session("singlecourse") ename.Text = singlecourse.CourseName Session("testname") = singlecourse.CourseName Seclist = que.GetSection(singlecourse.CourseCode) Qnolist = que.GetQnumber(singlecourse.CourseCode) Session("totsec") = Seclist Session("totqno") = Qnolist Session("queslist") = queslist t1.Text = Profile.Ttime pos = InStr(t1.Text, ":") h1.Value = t1.Text.Substring(0, pos - 1) 'h2.Value = t1.Text.Substring(pos, 2) h2.Value = Right(t1.Text, t1.Text.Length - pos) End If Else ViewState("qno") = CType(Session("summary"), Integer) Session("summary") = "" summbtn.Visible = True queslist = Session("queslist") ename.Text = Session("testname") t1.Text = Session("etime") pos = InStr(t1.Text, ":") h1.Value = t1.Text.Substring(0, pos - 1) h2.Value = t1.Text.Substring(pos, 2) End If queserial.Text = "Question : " + CType(queslist.Item(ViewState("qno")).QNo, String) & " of " & queslist.Count **(Error : Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index)** aquestion.Text = queslist.Item(ViewState("qno")).Question Regards Kausar

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” - Rick Osborne