Click here to Skip to main content
15,885,757 members
Home / Discussions / C#
   

C#

 
QuestionAuto Connect For HeadSet Pin
Smart Arab24-Mar-12 11:07
Smart Arab24-Mar-12 11:07 
AnswerRe: Auto Connect For HeadSet Pin
Richard Andrew x6424-Mar-12 13:14
professionalRichard Andrew x6424-Mar-12 13:14 
SuggestionRe: Auto Connect For HeadSet Pin
Eddy Vluggen25-Mar-12 3:30
professionalEddy Vluggen25-Mar-12 3:30 
GeneralNokia Blocked my country Pin
Smart Arab25-Mar-12 6:30
Smart Arab25-Mar-12 6:30 
QuestionVisualt Studio 2008 Team Suite for Blackberry Pin
mauricemcse24-Mar-12 2:36
mauricemcse24-Mar-12 2:36 
AnswerRe: Visualt Studio 2008 Team Suite for Blackberry Pin
Wes Aday24-Mar-12 4:36
professionalWes Aday24-Mar-12 4:36 
QuestionThe process cannot access the file because it is being used by another process. Pin
ausia1924-Mar-12 2:34
ausia1924-Mar-12 2:34 
AnswerRe: The process cannot access the file because it is being used by another process. Pin
OriginalGriff24-Mar-12 2:51
mveOriginalGriff24-Mar-12 2:51 
If you are going to post that much code, then please make sure you have formatted it - edit your message, and surround the code with
<pre lang="cs">
At the top, and
</pre>
at the bottom.
This will preserve the indentation, and make it much, much easier to read!

Example: As you have it:

private void ClickButton(string name)
{
if (string.IsNullOrWhiteSpace(name))
{
throw new ArgumentNullException("ClickButton: Needs a button name");
}
else
{
FieldInfo fi = this.GetType().GetField(name);
if (fi == null)
{
throw new ArgumentException(string.Format("ClickButton: Button \"{0}\" not found", name));
}
else
{
Button bnew = fi.GetValue(this) as Button;
if (bnew == null)
{
throw new ArgumentException(string.Format("ClickButton: \"{0}\" is not a button", name));
}
else
{
bnew.PerformClick();
}
}
}
}

With tags round it:
C#
private void ClickButton(string name)
    {
    if (string.IsNullOrWhiteSpace(name))
        {
        throw new ArgumentNullException("ClickButton: Needs a button name");
        }
    else
        {
        FieldInfo fi = this.GetType().GetField(name);
        if (fi == null)
            {
            throw new ArgumentException(string.Format("ClickButton: Button \"{0}\" not found", name));
            }
        else
            {
            Button bnew = fi.GetValue(this) as Button;
            if (bnew == null)
                {
                throw new ArgumentException(string.Format("ClickButton: \"{0}\" is not a button", name));
                }
            else
                {
                bnew.PerformClick();
                }
            }
        }
    }


I for one, am not looking at it as it is! Laugh | :laugh:
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

AnswerRe: The process cannot access the file because it is being used by another process. Pin
Luc Pattyn24-Mar-12 3:55
sitebuilderLuc Pattyn24-Mar-12 3:55 
AnswerRe: The process cannot access the file because it is being used by another process. PinPopular
Alan N24-Mar-12 4:25
Alan N24-Mar-12 4:25 
GeneralRe: The process cannot access the file because it is being used by another process. Pin
ausia1924-Mar-12 5:38
ausia1924-Mar-12 5:38 
Questionc++ or c# or vb.net Pin
ssssdaaads23-Mar-12 23:52
ssssdaaads23-Mar-12 23:52 
AnswerRe: c++ or c# or vb.net Pin
Abhinav S24-Mar-12 0:08
Abhinav S24-Mar-12 0:08 
AnswerRe: c++ or c# or vb.net Pin
PIEBALDconsult24-Mar-12 3:42
mvePIEBALDconsult24-Mar-12 3:42 
AnswerRe: c++ or c# or vb.net Pin
Wes Aday24-Mar-12 4:33
professionalWes Aday24-Mar-12 4:33 
GeneralRe: c++ or c# or vb.net Pin
Vipin_Arora26-Mar-12 19:39
Vipin_Arora26-Mar-12 19:39 
AnswerRe: c++ or c# or vb.net Pin
ProEnggSoft25-Mar-12 2:33
ProEnggSoft25-Mar-12 2:33 
AnswerRe: c++ or c# or vb.net Pin
Vipin_Arora26-Mar-12 19:31
Vipin_Arora26-Mar-12 19:31 
Questionserver connect Pin
heba abu ghaleih22 23-Mar-12 13:40
heba abu ghaleih22 23-Mar-12 13:40 
AnswerRe: server connect Pin
Richard Andrew x6423-Mar-12 13:53
professionalRichard Andrew x6423-Mar-12 13:53 
GeneralRe: server connect Pin
heba abu ghaleih22 23-Mar-12 14:24
heba abu ghaleih22 23-Mar-12 14:24 
GeneralRe: server connect Pin
Richard Andrew x6423-Mar-12 14:25
professionalRichard Andrew x6423-Mar-12 14:25 
GeneralRe: server connect Pin
heba abu ghaleih22 23-Mar-12 14:27
heba abu ghaleih22 23-Mar-12 14:27 
GeneralRe: server connect Pin
Richard Andrew x6423-Mar-12 14:29
professionalRichard Andrew x6423-Mar-12 14:29 
GeneralRe: server connect Pin
heba abu ghaleih22 23-Mar-12 14:30
heba abu ghaleih22 23-Mar-12 14:30 

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.