Click here to Skip to main content
15,905,563 members
Home / Discussions / C#
   

C#

 
GeneralRe: Sendkeys to excel without open workbook - C# Pin
bonjot19-Jun-14 2:27
bonjot19-Jun-14 2:27 
AnswerRe: Sendkeys to excel without open workbook - C# Pin
Dave Kreskowiak19-Jun-14 2:11
mveDave Kreskowiak19-Jun-14 2:11 
GeneralRe: Sendkeys to excel without open workbook - C# Pin
bonjot19-Jun-14 2:29
bonjot19-Jun-14 2:29 
QuestionC# FOR Loop Speed Issue Pin
exfosys18-Jun-14 21:02
exfosys18-Jun-14 21:02 
AnswerRe: C# FOR Loop Speed Issue Pin
Pete O'Hanlon18-Jun-14 21:18
mvePete O'Hanlon18-Jun-14 21:18 
AnswerRe: C# FOR Loop Speed Issue Pin
OriginalGriff18-Jun-14 21:51
mveOriginalGriff18-Jun-14 21:51 
GeneralRe: C# FOR Loop Speed Issue Pin
exfosys18-Jun-14 22:41
exfosys18-Jun-14 22:41 
GeneralRe: C# FOR Loop Speed Issue Pin
OriginalGriff18-Jun-14 23:12
mveOriginalGriff18-Jun-14 23:12 
AnswerRe: C# FOR Loop Speed Issue Pin
Mycroft Holmes18-Jun-14 22:31
professionalMycroft Holmes18-Jun-14 22:31 
GeneralRe: C# FOR Loop Speed Issue Pin
exfosys18-Jun-14 22:42
exfosys18-Jun-14 22:42 
GeneralRe: C# FOR Loop Speed Issue Pin
Mycroft Holmes18-Jun-14 22:54
professionalMycroft Holmes18-Jun-14 22:54 
GeneralRe: C# FOR Loop Speed Issue Pin
exfosys18-Jun-14 23:50
exfosys18-Jun-14 23:50 
GeneralRe: C# FOR Loop Speed Issue Pin
PIEBALDconsult19-Jun-14 4:11
mvePIEBALDconsult19-Jun-14 4:11 
SuggestionRe: C# FOR Loop Speed Issue Pin
Nathan Minier20-Jun-14 3:02
professionalNathan Minier20-Jun-14 3:02 
AnswerRe: C# FOR Loop Speed Issue Pin
V.19-Jun-14 4:13
professionalV.19-Jun-14 4:13 
QuestionFields in TFS WorkItem not able to change values Pin
hanusri18-Jun-14 7:20
hanusri18-Jun-14 7:20 
QuestionTCP connection to specific client Pin
kruegs3518-Jun-14 4:49
kruegs3518-Jun-14 4:49 
AnswerRe: TCP connection to specific client Pin
Eddy Vluggen18-Jun-14 5:15
professionalEddy Vluggen18-Jun-14 5:15 
GeneralRe: TCP connection to specific client Pin
kruegs3518-Jun-14 5:57
kruegs3518-Jun-14 5:57 
AnswerRe: TCP connection to specific client Pin
ZurdoDev18-Jun-14 8:29
professionalZurdoDev18-Jun-14 8:29 
AnswerRe: TCP connection to specific client Pin
jschell18-Jun-14 11:15
jschell18-Jun-14 11:15 
QuestionCorrect Syntax; No Result? Pin
Zachery Hysong17-Jun-14 7:50
Zachery Hysong17-Jun-14 7:50 
Hey guys, I have a strange problem. I am trying to write a function that looks at a TextBox that, if it is equal to a certain value, changes the value of a string to something else.
Here is my code:

I define the string in Main:
C#
string strDoorsOption1 = "test";

The Method is defined as:
C#
public void optionCheck(TextBox txt, string str)
{
    if (txt.Text == "0")
    {
        str = "+++";
    }
    else
    {
        str = "---";
    }
}

I call the Method like this:
C#
private void chkDoorsSafetyLaminated_CheckedChanged(object sender, EventArgs e)
{
    checkBoxClick3(chkDoorsSafetyLaminated, txtDoorsSafety1);

    optionCheck(txtDoorsSafety1, strDoorsOption1);
}


checkBoxClick3 is another Method that works as intended to change the value of a TextBox.
For reference, it is defined as follows:
C#
public void checkBoxClick3(CheckBox check, TextBox txt)
{
    /* Determine the CheckState of the Checkbox */
    if (check.CheckState == CheckState.Checked)
    {
        /* If the CheckState is Checked, then set the value to 1 */
        txt.Text = "1";
    }
    else
    {
        /* If the CheckState is Unchecked or Inditerminate, then set the value to 0 */
        txt.Text = "0";
    }
}


This works...:
C#
if (txtDoorsSafety1.Text == "0")
{
    strDoorsOption1 = "+++";
}
else
{
    strDoorsOption1 = "---";
}


But when I call optionCheck(txtDoorsSafety1, strDoorsOption1); it acts as if the method is empty. It completely compiles with no errors or warnings, it simply does nothing.

Any help would be appreciated.
AnswerRe: Correct Syntax; No Result? Pin
Eddy Vluggen17-Jun-14 8:05
professionalEddy Vluggen17-Jun-14 8:05 
GeneralRe: Correct Syntax; No Result? Pin
Zachery Hysong17-Jun-14 8:22
Zachery Hysong17-Jun-14 8:22 
GeneralRe: Correct Syntax; No Result? Pin
Eddy Vluggen17-Jun-14 8:50
professionalEddy Vluggen17-Jun-14 8:50 

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.