Click here to Skip to main content
16,010,114 members
Home / Discussions / C#
   

C#

 
AnswerRe: Problem Replacing Smart Quotes Pin
Guffa6-Feb-09 14:51
Guffa6-Feb-09 14:51 
QuestionC# Registry Change Event Pin
Michael Fritzius6-Feb-09 12:07
professionalMichael Fritzius6-Feb-09 12:07 
AnswerRe: C# Registry Change Event Pin
Christian Graus6-Feb-09 12:42
protectorChristian Graus6-Feb-09 12:42 
AnswerRe: C# Registry Change Event Pin
cmk6-Feb-09 15:54
cmk6-Feb-09 15:54 
AnswerRe: C# Registry Change Event Pin
Giorgi Dalakishvili6-Feb-09 21:00
mentorGiorgi Dalakishvili6-Feb-09 21:00 
Questionhow to work with an opened text file in list box? Pin
pcsience6-Feb-09 9:57
pcsience6-Feb-09 9:57 
AnswerRe: how to work with an opened text file in list box? Pin
Luc Pattyn6-Feb-09 10:12
sitebuilderLuc Pattyn6-Feb-09 10:12 
GeneralRe: how to work with an opened text file in list box? Pin
pcsience7-Feb-09 8:25
pcsience7-Feb-09 8:25 
hi,
first of all tnx for your consideration.
yes I have a class called person.see,I don't have problem with saving and opening a text file & showing it in a list box.the problem is when I save a text file and close the program (stop it running)
and then run it again and click the Open button it opens the text file,and shows it in the list box,but can't do any searching over the opened file!!!
this is the search code:

private void btnSearch_Click(object sender, EventArgs e)
{
//objPersonArraylist is a hashtable object
if (objPersonArraylist.Contains(txtEmail.Text.ToLower()) == true)
{
//person is my class
MessageBox.Show("The person is :" + ((Person)objPersonArraylist[txtEmail.Text.ToLower()]).FullName, "Found!");
}
else
{
MessageBox.Show("No such person exist in the list!", "Not Found!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

and this is the Open file code:

private void btnOpen_Click(object sender, EventArgs e)
{
string at="@";
openFileDialog1.Title = "Open A Text File";
openFileDialog1.Filter = "Text File(*.txt)|*.txt|All Files(*.*)|*.*";
openFileDialog1.FilterIndex = 1;
openFileDialog1.InitialDirectory = "C:\\Users\\Golputer\\Documents";
openFileDialog1.DefaultExt = "txt";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
strFileName = openFileDialog1.FileName;
try
{
lstOfNames.Items.Add(System.IO.File.ReadAllText(strFileName));
int what = lstOfNames.FindString(at,-1);
if (what != -1)
{
lstOfNames.SetSelected(what, true);
MessageBox.Show("that's it,found!");
}
else
{
MessageBox.Show("Sorry,item is not here");
}
}
catch
{
MessageBox.Show("Sorry,can't open the file!");
}
}
}
AnswerRe: how to work with an opened text file in list box? Pin
Luc Pattyn7-Feb-09 9:09
sitebuilderLuc Pattyn7-Feb-09 9:09 
QuestionRe: how to work with an opened text file in list box? Pin
pcsience8-Feb-09 8:53
pcsience8-Feb-09 8:53 
AnswerRe: how to work with an opened text file in list box? Pin
Luc Pattyn8-Feb-09 9:03
sitebuilderLuc Pattyn8-Feb-09 9:03 
GeneralRe: how to work with an opened text file in list box? Pin
pcsience8-Feb-09 9:42
pcsience8-Feb-09 9:42 
AnswerRe: how to work with an opened text file in list box? Pin
Luc Pattyn8-Feb-09 10:04
sitebuilderLuc Pattyn8-Feb-09 10:04 
QuestionRe: how to work with an opened text file in list box? Pin
pcsience9-Feb-09 9:08
pcsience9-Feb-09 9:08 
AnswerRe: how to work with an opened text file in list box? Pin
Luc Pattyn9-Feb-09 9:19
sitebuilderLuc Pattyn9-Feb-09 9:19 
QuestionCannot figure out how to get the row I need in a datatable Pin
compninja256-Feb-09 9:49
compninja256-Feb-09 9:49 
AnswerRe: Cannot figure out how to get the row I need in a datatable Pin
Luc Pattyn6-Feb-09 10:03
sitebuilderLuc Pattyn6-Feb-09 10:03 
GeneralRe: Cannot figure out how to get the row I need in a datatable Pin
compninja256-Feb-09 10:19
compninja256-Feb-09 10:19 
GeneralRe: Cannot figure out how to get the row I need in a datatable Pin
compninja259-Feb-09 3:04
compninja259-Feb-09 3:04 
AnswerRe: Cannot figure out how to get the row I need in a datatable Pin
Ennis Ray Lynch, Jr.6-Feb-09 10:48
Ennis Ray Lynch, Jr.6-Feb-09 10:48 
GeneralRe: Cannot figure out how to get the row I need in a datatable Pin
compninja259-Feb-09 2:13
compninja259-Feb-09 2:13 
GeneralRe: Cannot figure out how to get the row I need in a datatable Pin
Ennis Ray Lynch, Jr.9-Feb-09 2:42
Ennis Ray Lynch, Jr.9-Feb-09 2:42 
GeneralRe: Cannot figure out how to get the row I need in a datatable [modified] Pin
compninja259-Feb-09 2:52
compninja259-Feb-09 2:52 
QuestionIs using a User Control Embedded Class a good practice? Pin
MacSpudster6-Feb-09 9:05
professionalMacSpudster6-Feb-09 9:05 
AnswerNot really the place for this question Pin
Pete O'Hanlon6-Feb-09 11:26
mvePete O'Hanlon6-Feb-09 11:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.