Click here to Skip to main content
15,881,812 members
Home / Discussions / C#
   

C#

 
AnswerRe: plz check my sql code. is it correct ? Pin
Pete O'Hanlon5-Mar-13 22:41
mvePete O'Hanlon5-Mar-13 22:41 
GeneralRe: plz check my sql code. is it correct ? Pin
Member 103026305-Mar-13 23:43
Member 103026305-Mar-13 23:43 
GeneralRe: plz check my sql code. is it correct ? Pin
Pete O'Hanlon5-Mar-13 23:50
mvePete O'Hanlon5-Mar-13 23:50 
AnswerRe: plz check my sql code. is it correct ? Pin
PIEBALDconsult6-Mar-13 16:55
mvePIEBALDconsult6-Mar-13 16:55 
GeneralRe: plz check my sql code. is it correct ? Pin
Member 1030263012-Mar-13 19:15
Member 1030263012-Mar-13 19:15 
QuestionCreate DirectoryEntry Error Pin
arkno15-Mar-13 22:18
arkno15-Mar-13 22:18 
AnswerRe: Create DirectoryEntry Error Pin
Pete O'Hanlon5-Mar-13 22:45
mvePete O'Hanlon5-Mar-13 22:45 
QuestionReplacing items within a string Pin
Goaty651095-Mar-13 13:25
Goaty651095-Mar-13 13:25 
Hello CP!

Alright, I thought this would be simple, but apparently I don't know what I am doing. I have a Rich Text Box that populates upon form load. There are fields that are meant to be updated by text boxes on this form. Here's a snip of the form_load:

C#
private void Form1_Load(object sender, EventArgs e)
{
    string cifTime = timeCIF.Text;
    string chkCIF = "N";
    emailBody.Text = "Example\nCIF = " + chkCIF + "\nTIME = " + timeCIF.Text;
}

So what happens here is the form opens and populates a rich text box with:

Example
CIF = N
TIME =

Now, what I need to have a button do is update just the items I have defined, in this case chkCIF (a check box) and timeCIF.Text (a textbox). I have a button that's called update, and here's what it looks like.

C#
private void updateButton_Click(object sender, EventArgs e)
{
    //There is a combo box on this form and example is the first option
    if (comboInst.Text == "Example")
    {
        //Here is where the check box verification is, if it is true it should change the N to Y
        if (checkCIF.Checked == true)
        {
            //This part needs to update the current contents of the email body. Obviously, this isn't working for me so I commented out some examples I tried...
            //string s = emailBody.Text;
            //string chkCIF = "Y";

            //s = s.Replace("N", chkCIF);

            string theString = emailBody.Text;
            theString.Remove(3, 2).Insert(3, "Y");
        }
    }


And there you have it. I just need to be able to update certain defined words from a string with a click of a button. Thanks in advance Smile | :)
AnswerRe: Replacing items within a string Pin
NotPolitcallyCorrect5-Mar-13 13:33
NotPolitcallyCorrect5-Mar-13 13:33 
GeneralRe: Replacing items within a string Pin
Goaty651095-Mar-13 13:39
Goaty651095-Mar-13 13:39 
GeneralRe: Replacing items within a string Pin
NotPolitcallyCorrect5-Mar-13 14:26
NotPolitcallyCorrect5-Mar-13 14:26 
GeneralRe: Replacing items within a string Pin
Goaty651095-Mar-13 15:30
Goaty651095-Mar-13 15:30 
GeneralRe: Replacing items within a string Pin
SoMad5-Mar-13 23:21
professionalSoMad5-Mar-13 23:21 
GeneralRe: Replacing items within a string Pin
NotPolitcallyCorrect6-Mar-13 2:16
NotPolitcallyCorrect6-Mar-13 2:16 
GeneralRe: Replacing items within a string Pin
Bogza.Anton5-Mar-13 14:45
Bogza.Anton5-Mar-13 14:45 
GeneralRe: Replacing items within a string Pin
Goaty651095-Mar-13 15:32
Goaty651095-Mar-13 15:32 
GeneralRe: Replacing items within a string Pin
Bogza.Anton5-Mar-13 15:58
Bogza.Anton5-Mar-13 15:58 
AnswerRe: Replacing items within a string Pin
Richard MacCutchan5-Mar-13 22:36
mveRichard MacCutchan5-Mar-13 22:36 
GeneralRe: Replacing items within a string Pin
NotPolitcallyCorrect6-Mar-13 2:52
NotPolitcallyCorrect6-Mar-13 2:52 
GeneralRe: Replacing items within a string Pin
Richard MacCutchan6-Mar-13 6:18
mveRichard MacCutchan6-Mar-13 6:18 
Questiondisplay chart Pin
Member 98700585-Mar-13 9:42
Member 98700585-Mar-13 9:42 
AnswerRe: display chart Pin
Jegan Thiyagesan5-Mar-13 23:03
Jegan Thiyagesan5-Mar-13 23:03 
GeneralRe: display chart Pin
Member 98700586-Mar-13 3:32
Member 98700586-Mar-13 3:32 
QuestionWhat is the best way to create a matrix in C#? Pin
raymond leadingham5-Mar-13 7:09
raymond leadingham5-Mar-13 7:09 
AnswerRe: What is the best way to create a matrix in C#? Pin
Matt T Heffron5-Mar-13 7:28
professionalMatt T Heffron5-Mar-13 7:28 

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.