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
Venkat S
1.5k
234
203.6k
how to display xml data searching values in listbox
Jun 17 2011 5:14 AM
Hi friends ,
i m new for this.
i am searching the data in xml file what i entered in textbox (this ok). i ll take matches data in to messagbox but i m not able to display in listbox .
way any one knows.
my requirement is
i want to display in listbox and then i click any value in listbox that value gos to textbox.
please give me any idea.
hear is my code
private void textBox2_TextChanged(object sender, EventArgs e)
{
string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
XDocument doc = XDocument.Load(path + @"\Refrigirater.xml"); // or whatever thew file's called
string search = textBox2.Text.Trim();
//to search particular column in xml database
string[] results = (from element in doc.Element("DATAPACKET").Elements("data1").Elements("R_PRE") where element.Value.StartsWith(search) select element.Value).ToArray();
//to search in all columns table
//string[] results = (from element in doc.Element("DATAPACKET").Elements("data1").Elements() where element.Value.StartsWith(search) select element.Value).ToArray();
if (textBox2.Text == "")
{
MessageBox.Show("Please Enter Value");
}
else
{
if (results.Length > 0)
{
string message = String.Join("\r\n", results);
MessageBox.Show("\r\n" + message);
}
else
{
MessageBox.Show("No matches were found");
}
}
what i m searching that all matches data in message ll there.
please give me any idea.
Thanks
Venkat.S
Reply
Answers (
2
)
Use Stored Procedure in ASP.NET with GridView.
How to delete image according to intial string of the images