.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 11th, 2012, 03:22 AM
dongtrien dongtrien is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2010
Posts: 70 dongtrien User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 56 m 13 sec
Reputation Power: 3
Error index out of range exception was unhandled by user code

You can for example enter the length and width of the web (VS.NET2005), when it runs out of range index error exception was unhandled by user code for chieudai

public class Tinh
{
private Int32 _quanhuyen;
private String _diachiNha;
private Double _chieudai;
private Double _chieurong;
private Double _dientichDat;
}

public Int32 Quanhuyen
{
get { return _quanhuyen; }
set { _quanhuyen = value; }
}

public String DiachiNha
{
get { return _diachiNha; }
set { _diachiNha = value; }
}

public Double Chieudai
{
get { return _chieudai; }
set { _chieudai = value; }
}

public Double Chieurong
{
get { return _chieurong; }
set { _chieurong = value; }
}

public Double DientichDat
{
get { return _dientichDat; }
set { _dientichDat = value; }
}

private Tinh DienTich(IDataReader dr, bool GetTotalRecords)
{
Tinh obj = new Tinh();
...
obj.Quanhuyen = (dr["Quanhuyen"] is DBNull) ? Int32.MinValue : (Int32)dr["Quanhuyen"];
obj.DiachiNha = (dr["DiachiNha"] is DBNull) ? String.Empty : (String)dr["DiachiNha"];
// bottom line this error index out of range exception was unhandled by user code
obj.Chieudai = (dr["Chieudai"] is DBNull) ? Double.MinValue : (Double)dr["Chieudai"];
obj.Chieurong = (dr["Chieurong"] is DBNull) ? Double.MinValue : (Double)dr["Chieurong"];
obj.DientichDat = (dr["DientichDat"] is DBNull) ? Double.MinValue : (Double)dr["DientichDat"];
if (GetTotalRecords)
obj.TotalRecords = (dr["TotalRecords"] is DBNull) ? -1 : Globals.ConvertToInt32(dr["TotalRecords"]);

return obj;
}

error index out of range exception was unhandled by user code

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Error index out of range exception was unhandled by user code

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap