Does it crash when the page is first loading? If so, the method cbo_Country_SelectedIndexC
Could you post also the stack trace of the error and the code for the GetProvinceList and the GetCountryList methods?
Main Topics
Browse All Topicsprivate void cbo_Country_SelectedIndexC
{
// create an array of provinces
WebSUtil.StateProvince[] stateprovinceArr;
// create a new object srvCountryCode
WebSUtil.SrvUtil srvCountryCode = new WebSUtil.SrvUtil();
if (this.cbo_Country.Selected
{
if (cbo_Province.DataSource != null)
((DataTable)cbo_Province.D
// Populate the array of provinces
stateprovinceArr = srvCountryCode.GetProvince
if (stateprovinceArr != null)
{
DataTable dt = new DataTable();
dt.Columns.Add("name");
dt.Columns.Add("id");
for (int i = 0; i < stateprovinceArr.Length; i++)
{
DataRow dr = dt.NewRow();
dr["name"] = stateprovinceArr[i].Name;
dr["id"] = stateprovinceArr[i].Id.ToS
dt.Rows.Add(dr);
}
this.cbo_Province.DataSour
this.cbo_Province.DisplayM
this.cbo_Province.ValueMem
}
}
}
On the first start on the app it crashes on the first start. There must be a fix for this.
stateprovinceArr = srvCountryCode.GetProvince
Unable to cast object of type 'System.Data.DataRowView' to type 'System.IConvertible'.
"Unable to cast object of type 'System.Data.DataRowView' to type 'System.IConvertible'."
I have this in the Load Form:
private void InitializeDropDownListCoun
{
WebSUtil.CountryCode[] countryArr = srvCountryCode.GetCountryL
DataTable dt = new DataTable();
dt.Columns.Add("name");
dt.Columns.Add("id");
for (int i = 0; i < countryArr.Length; i++)
{
DataRow dr = dt.NewRow();
dr["name"]=countryArr[i].N
dr["id"]=countryArr[i].Id.
dt.Rows.Add(dr);
}
this.cbo_Country.DataSourc
this.cbo_Country.DisplayMe
this.cbo_Country.ValueMemb
}
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
It fails on France:
- cbo_Province.DataSource {} object {System.Data.DataTable}
+ base {} System.ComponentModel.Mars
CaseSensitive false bool
+ ChildRelations {System.Data.DataRelationC
+ Columns {System.Data.DataColumnCol
+ Constraints {System.Data.ConstraintCol
+ DataSet null System.Data.DataSet
+ DefaultView {System.Data.DataView} System.Data.DataView
DisplayExpression "" string
+ ExtendedProperties Count = 0 System.Data.PropertyCollec
HasErrors false bool
IsInitialized true bool
+ Locale {en-US} System.Globalization.Cultu
MinimumCapacity 50 int
Namespace "" string
+ ParentRelations {System.Data.DataRelationC
Prefix "" string
PrimaryKey {Dimensions:[0]} System.Data.DataColumn[]
RemotingFormat Xml System.Data.SerializationF
+ Rows {System.Data.DataRowCollec
Site null System.ComponentModel.ISit
TableName "" string
+ Static members
+ Non-Public members
{"Unable to cast object of type 'System.String' to type 'System.Data.DataRowView'.
// I would suggest doing it this way
this.cbo_Country.DisplayMe
this.cbo_Country.ValueMemb
this.cbo_Country.DataSourc
// note that the displayMember and ValueMember is set before DataSource is set
// this will result int this.comboBox1.SelectedVal
// your stateprovinceArr code should now look like (if not exactly) below
stateprovinceArr =
srvCountryCode.GetProvince
Convert.ToDecimal(this.cbo
Business Accounts
Answer for Membership
by: gis-jediPosted on 2007-06-26 at 06:29:52ID: 19363408
Try this:
lectedValu e; List(dSele ctedId);
decimal dSelectedId = (decimal)this.cboCounty.Se
stateprovinceArr = srvCountryCode.GetProvince