Click here to Skip to main content
15,914,452 members
Home / Discussions / C#
   

C#

 
AnswerRe: Need fast way to populate treeView Pin
Whytespot22-Aug-07 10:44
Whytespot22-Aug-07 10:44 
AnswerRe: Saving PageSetupDialog.PageSettings; Pin
Luc Pattyn22-Aug-07 4:39
sitebuilderLuc Pattyn22-Aug-07 4:39 
GeneralRe: Saving PageSetupDialog.PageSettings; Pin
udikantz22-Aug-07 5:09
udikantz22-Aug-07 5:09 
QuestionWrite Dataset to SQL Pin
GermanDM22-Aug-07 3:50
GermanDM22-Aug-07 3:50 
AnswerRe: Write Dataset to SQL Pin
Vasudevan Deepak Kumar22-Aug-07 5:00
Vasudevan Deepak Kumar22-Aug-07 5:00 
AnswerRe: Write Dataset to SQL Pin
costavo22-Aug-07 5:00
costavo22-Aug-07 5:00 
AnswerRe: Write Dataset to SQL Pin
Giorgi Dalakishvili22-Aug-07 5:01
mentorGiorgi Dalakishvili22-Aug-07 5:01 
Questionstring.IndexOf help Pin
solutionsville22-Aug-07 3:28
solutionsville22-Aug-07 3:28 
I want to take the value of textBox1.text, pass it to a find routine and then display the results of all lines that have the given text.

The find portion I have figured out. the IndexOf routine I have not figured out.

Here is my find routine;

private void btnFind_Click(object sender, System.EventArgs e)
{
try
{
int StartPosition;
StringComparison SearchType;
if (chkMatchCase.Checked == true)
{
SearchType = StringComparison.Ordinal;
}
else
{
SearchType = StringComparison.OrdinalIgnoreCase;
}
StartPosition = mMain.rtbDoc.Text.IndexOf(txtSearchTerm.Text, SearchType);
if (StartPosition == 0)
{
MessageBox.Show("String: " + txtSearchTerm.Text.ToString() + " not found", "No Matches", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
return;
}
mMain.rtbDoc.Select(StartPosition, txtSearchTerm.Text.Length);
mMain.rtbDoc.ScrollToCaret();
mMain.Focus();
btnFindNext.Enabled = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString(), "Error");
}
}

Lets say I want to search for and display every line that has the word "one" in it and then display it in a RichTextBox

one plus four
two plus four
three plus four
one minus four
one divided by four
two minus four
two divided by four
three plus five
three minus five

When the search is done, it show like this in the RTB with nothing else.;

one plus four
one minus four
one divided by four

Thanks in advance!

Brian


AnswerRe: string.IndexOf help Pin
Martin#22-Aug-07 3:45
Martin#22-Aug-07 3:45 
GeneralRe: string.IndexOf help Pin
solutionsville22-Aug-07 4:06
solutionsville22-Aug-07 4:06 
GeneralRe: string.IndexOf help Pin
Martin#22-Aug-07 4:30
Martin#22-Aug-07 4:30 
GeneralRe: string.IndexOf help Pin
solutionsville22-Aug-07 4:43
solutionsville22-Aug-07 4:43 
GeneralRe: string.IndexOf help Pin
Martin#22-Aug-07 4:47
Martin#22-Aug-07 4:47 
AnswerRe: string.IndexOf help Pin
Justin Perez22-Aug-07 3:46
Justin Perez22-Aug-07 3:46 
QuestionC# DATE FORMAT Pin
KETAN.RK22-Aug-07 3:09
KETAN.RK22-Aug-07 3:09 
AnswerRe: C# DATE FORMAT Pin
J4amieC22-Aug-07 3:10
J4amieC22-Aug-07 3:10 
GeneralRe: C# DATE FORMAT Pin
KETAN.RK22-Aug-07 5:01
KETAN.RK22-Aug-07 5:01 
GeneralRe: C# DATE FORMAT Pin
J4amieC22-Aug-07 5:56
J4amieC22-Aug-07 5:56 
AnswerRe: C# DATE FORMAT Pin
Levon Nalbandyan22-Aug-07 3:32
Levon Nalbandyan22-Aug-07 3:32 
Questiontooltips Pin
Sunshine Always22-Aug-07 2:11
Sunshine Always22-Aug-07 2:11 
AnswerRe: tooltips Pin
SpiveyC#22-Aug-07 3:45
SpiveyC#22-Aug-07 3:45 
GeneralRe: tooltips Pin
Sunshine Always22-Aug-07 3:58
Sunshine Always22-Aug-07 3:58 
GeneralRe: tooltips Pin
Luc Pattyn22-Aug-07 4:20
sitebuilderLuc Pattyn22-Aug-07 4:20 
QuestionWierd req from boss Pin
SpiveyC#22-Aug-07 2:10
SpiveyC#22-Aug-07 2:10 
AnswerRe: Wierd req from boss Pin
Giorgi Dalakishvili22-Aug-07 2:12
mentorGiorgi Dalakishvili22-Aug-07 2:12 

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.