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

C#

 
GeneralRe: Executing programs Pin
Stefan_ Spenz6-Oct-05 1:51
Stefan_ Spenz6-Oct-05 1:51 
AnswerRe: Executing programs Pin
User 66586-Oct-05 1:41
User 66586-Oct-05 1:41 
GeneralRe: Executing programs Pin
Stefan_ Spenz6-Oct-05 1:52
Stefan_ Spenz6-Oct-05 1:52 
Questionhow to get the target of shortcut Pin
Anonymous5-Oct-05 22:27
Anonymous5-Oct-05 22:27 
AnswerRe: how to get the target of shortcut Pin
Heath Stewart6-Oct-05 7:28
protectorHeath Stewart6-Oct-05 7:28 
QuestionDatabase query Pin
ybasha5-Oct-05 21:39
ybasha5-Oct-05 21:39 
AnswerRe: Database query Pin
Heath Stewart6-Oct-05 6:43
protectorHeath Stewart6-Oct-05 6:43 
QuestionSearching for a string value Pin
Brendan Vogt5-Oct-05 20:37
Brendan Vogt5-Oct-05 20:37 
Hi there,

I am using C#. I have to create a random unique identifier that will be used as a primary key in my table. I created a string array dynamically that contains all upper case letters, and numbers 0-9 like this:

private ArrayList m_arrCharPool;
private string m_sExcludeChars = "IO01";

In the constructor I initialise my array:

m_arrCharPool = new ArrayList();

// Clear the array
m_arrCharPool.Clear();

// If required, include uppercase letters A thru Z
if(m_bIncludeLetters)
{
for(int i = 65; i < 91; ++i)
{
m_arrCharPool.Add(Convert.ToChar(i).ToString());
}
}

// If required, include numbers 0 thru 9
if(m_bIncludeNumbers)
{
for(int i = 48; i < 58; ++i)
{
m_arrCharPool.Add(Convert.ToChar(i).ToString());
}
}


So basically my array looks something like this:
"A", "B", "C".... "7", "8", "9"

No you will see I create a string variable called m_sExcludeChars. This variable represents all the characters that are not allowed in the array. So now I need to loop through the m_arrCharPool array, and search for each character in m_sExcludeChars, and delete that array element totally from the array.

My loop is something like this, but I know it is wrong. Can someone please help me with my loop so that it performs correctly. If I can do this whole process differently, please let me know:

// Remove the following characters from the array: I, O, 0, 1
for(int i = 0; i < m_arrCharPool.Count; ++i)
{
foreach(char j in m_sExcludeChars)
{
if(m_arrCharPool.IndexOf(j))
{
m_arrCharPool.RemoveAt(i);
}
}
}


Regards,
Brendan
AnswerRe: Searching for a string value Pin
S. Senthil Kumar5-Oct-05 20:45
S. Senthil Kumar5-Oct-05 20:45 
GeneralRe: Searching for a string value Pin
Brendan Vogt5-Oct-05 21:01
Brendan Vogt5-Oct-05 21:01 
GeneralRe: Searching for a string value Pin
S. Senthil Kumar5-Oct-05 21:12
S. Senthil Kumar5-Oct-05 21:12 
GeneralRe: Searching for a string value Pin
Brendan Vogt5-Oct-05 21:55
Brendan Vogt5-Oct-05 21:55 
AnswerRe: Searching for a string value Pin
Guffa5-Oct-05 23:01
Guffa5-Oct-05 23:01 
GeneralRe: Searching for a string value Pin
Brendan Vogt5-Oct-05 23:10
Brendan Vogt5-Oct-05 23:10 
AnswerRe: Searching for a string value Pin
Guffa6-Oct-05 0:22
Guffa6-Oct-05 0:22 
GeneralRe: Searching for a string value Pin
Brendan Vogt6-Oct-05 0:41
Brendan Vogt6-Oct-05 0:41 
GeneralRe: Searching for a string value Pin
Guffa6-Oct-05 1:20
Guffa6-Oct-05 1:20 
QuestionSetup starts after installation again Pin
Ariadne5-Oct-05 20:31
Ariadne5-Oct-05 20:31 
AnswerRe: Setup starts after installation again (minor bug) Pin
Ariadne6-Oct-05 20:14
Ariadne6-Oct-05 20:14 
QuestionSockets in C# Pin
Thoughthopper5-Oct-05 20:04
Thoughthopper5-Oct-05 20:04 
Questionsetup problem Pin
shashank veerkar5-Oct-05 19:40
shashank veerkar5-Oct-05 19:40 
AnswerRe: setup problem Pin
Ariadne5-Oct-05 20:49
Ariadne5-Oct-05 20:49 
QuestionHow to find all fax machines on asystem Pin
shashank veerkar5-Oct-05 18:48
shashank veerkar5-Oct-05 18:48 
QuestionHow to get an array of Pens in a user defined class to &quot;work&quot; in a WinForm? Pin
Anonymous5-Oct-05 16:39
Anonymous5-Oct-05 16:39 
AnswerRe: How to get an array of Pens in a user defined class to &quot;work&quot; in a WinForm? Pin
Mohamad Al Husseiny5-Oct-05 18:59
Mohamad Al Husseiny5-Oct-05 18:59 

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.