Click here to Skip to main content
15,922,894 members
Home / Discussions / C#
   

C#

 
QuestionHow to get all properties of system_comobject(like word 2003) using reflection ? Pin
caiter6-Dec-05 5:58
caiter6-Dec-05 5:58 
QuestionBinding a ds to a textbox control Pin
steve_rm6-Dec-05 5:55
steve_rm6-Dec-05 5:55 
Questiononly get one field when import csv to datagrid Pin
tabulation6-Dec-05 5:41
tabulation6-Dec-05 5:41 
QuestionInteger formatting in C# appending "st", "nd", rd" or "th" to an int. Pin
tsramkumar6-Dec-05 5:08
tsramkumar6-Dec-05 5:08 
AnswerRe: Integer formatting in C# appending "st", "nd", rd" or "th" to an int. Pin
J4amieC6-Dec-05 5:47
J4amieC6-Dec-05 5:47 
QuestionStatusbar Icon - Display Issue Pin
mcljava6-Dec-05 4:03
mcljava6-Dec-05 4:03 
AnswerRe: Statusbar Icon - Display Issue Pin
Pablo Hernandez Valdes6-Dec-05 8:31
Pablo Hernandez Valdes6-Dec-05 8:31 
Questionusing regex to find part of a string Pin
melanieab6-Dec-05 3:52
melanieab6-Dec-05 3:52 
Hey,
I'm trying to search for a string in a datatable using DataView.Find, and ran across the Regex class. I got the find and select to work when the whole string is found, but now I need it to work for just part of the string.
Here's what I have so far:
// tCat - the table name
// searchThis - the string I want to find
// dg - the datagrid
DataView dv = tCat.DefaultView; <br />
Regex reg = new Regex(searchThis,RegexOptions.IgnoreCase);<br />
if (searchBy == "cust")<br />
{<br />
dv.Sort = "Customer ASC";<br />
int i = dv.Find(reg);<br />
if(i > dv.Table.Rows.Count || i < 0){MessageBox.Show("No file found");}<br />
else {dg.CurrentRowIndex = i; dg.Select(i);}<br />
}


I saw that IsMatch finds parts of strings, but I need to be sure that only the beginning of a string will partially match, i.e. searching for "rich" will match "Richard", but not "Fredrich".
So at the moment I'm not sure how to incorporate the IsMatch into the code above, as well as make sure that only the beginning of the string is searched.
Thanks again for any help!!!!!
Mel
AnswerRe: using regex to find part of a string Pin
S. Senthil Kumar6-Dec-05 4:37
S. Senthil Kumar6-Dec-05 4:37 
GeneralRe: using regex to find part of a string Pin
melanieab6-Dec-05 5:09
melanieab6-Dec-05 5:09 
GeneralRe: using regex to find part of a string Pin
S. Senthil Kumar6-Dec-05 5:16
S. Senthil Kumar6-Dec-05 5:16 
GeneralRe: using regex to find part of a string Pin
melanieab6-Dec-05 5:47
melanieab6-Dec-05 5:47 
GeneralRe: using regex to find part of a string Pin
S. Senthil Kumar6-Dec-05 6:00
S. Senthil Kumar6-Dec-05 6:00 
GeneralRe: using regex to find part of a string Pin
melanieab6-Dec-05 7:39
melanieab6-Dec-05 7:39 
GeneralRe: using regex to find part of a string Pin
S. Senthil Kumar6-Dec-05 20:36
S. Senthil Kumar6-Dec-05 20:36 
QuestionCustom Controls And Events Pin
rich_wenger6-Dec-05 3:48
rich_wenger6-Dec-05 3:48 
QuestionAutoRedraw Pin
Sabry19056-Dec-05 2:47
Sabry19056-Dec-05 2:47 
Question.NET Remoting and recorded sound? Pin
mikker_1236-Dec-05 1:27
mikker_1236-Dec-05 1:27 
Questiondll Pin
ambedkar6-Dec-05 1:26
ambedkar6-Dec-05 1:26 
AnswerRe: dll Pin
Colin Angus Mackay6-Dec-05 1:51
Colin Angus Mackay6-Dec-05 1:51 
Questionalgorithm for 6 digits unique number Pin
Ronen Tidhar6-Dec-05 1:12
Ronen Tidhar6-Dec-05 1:12 
AnswerRe: algorithm for 6 digits unique number Pin
Colin Angus Mackay6-Dec-05 1:19
Colin Angus Mackay6-Dec-05 1:19 
AnswerRe: algorithm for 6 digits unique number Pin
J4amieC6-Dec-05 2:25
J4amieC6-Dec-05 2:25 
GeneralRe: algorithm for 6 digits unique number Pin
Ronen Tidhar7-Dec-05 1:07
Ronen Tidhar7-Dec-05 1:07 
GeneralRe: algorithm for 6 digits unique number Pin
Ronen Tidhar7-Dec-05 1:51
Ronen Tidhar7-Dec-05 1:51 

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.