TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
abburi chowdary
NA
60
15k
Object reference not set toan instance of anobject. C#combob
Apr 25 2018 4:39 AM
hi
i have written below code to get values in combobox nut i am getting error as object reference not set .please suggest
void
CmbhospitalsSelectedIndexChanged(
object
sender, EventArgs e)
{
try
{
WebClient wc =
new
WebClient();
wc.Headers[
"Content-type"
] =
"application/x-www-form-urlencoded"
;
NameValueCollection collection =
new
NameValueCollection();
collection.Add(
"hid"
,
"0"
);
collection.Add(
"sno"
,
"2"
);
byte
[] bret = wc.UploadValues(URLAuth, collection);
string
sret =
""
;
sret = System.Text.Encoding.ASCII.GetString(bret);
int
count=0;
string
[,] hospitalslist ;
if
(sret !=
""
)
{
XmlDocument readDoc =
new
XmlDocument();
readDoc.LoadXml(sret);
count = readDoc.SelectNodes(
"hoskeys/hkids"
).Count;
hospitalslist =
new
string
[count, 2];
// alternately, _doc.Load( _strFilename); to read from a file.
XmlNodeList xhkid = readDoc.GetElementsByTagName(
"hkid"
);
XmlNodeList xhos_key = readDoc.GetElementsByTagName(
"hos_key"
);
for
(
int
i= 0; i <count; i++)
{
hospitalslist[i, 0] = xhkid[i].InnerText;
hospitalslist[i, 1] = xhos_key[i].InnerText;
}
for
(
int
i = 0; i < hospitalslist.GetLength(0); i++)
{
cmbhusers.Items.Add(
new
{ Text = hospitalslist[i, 1], Key=Convert.ToInt16(hospitalslist[i, 0]) });
}
cmbhusers.DisplayMember =
"Text"
;
cmbhusers.ValueMember =
"Key"
;
}
}
catch
(Exception e1)
{
MessageBox.Show(e1.Message);
}
}
Reply
Answers (
2
)
.Net using hindi Font
hi i'm having troubles to predict a result using weka .Net