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
Sabari Prabu
NA
10
2.6k
When i make listbox without extension i am facing exception
Apr 28 2015 9:17 AM
string folder = @"D:\\General";
string[] files = Directory.GetFiles(folder, "*.txt");
foreach (string i in files)
listBox1.Items.Add(Path.GetFileNameWithoutExtension(i.Trim()));
In the above code i given a local drive as input to listbox and filtered the .txt files.
when i click a radio button the output will be displayed in a text box.
Then i made the items in listbox to appear only with name without extension.
When i make it, i face a exception in other codes below....
private void radiobtn_CheckedChanged(object sender, EventArgs e)
{
StreamReader objstream = new StreamReader(listBox1.Items[listBox1.SelectedIndex].ToString());-----
here i face File Not Found exception
Textbox1.Text = objstream.ReadToEnd();
}
Can anyone help please??
Reply
Answers (
4
)
How to filter lines in textbox
keypres doesnt fire after textchanged