I have a form which has in which data is entered in both Textboxes and Checkboxes, when the "Copy" button is clicked all the fields are copied to be pasted elsewhere. I am trying to convert the Checkboxes to Yes or No When Pasted.

Private Sub btnCopyNotes_Click(sender As Object, e As EventArgs) Handles btnCopyNotes.Click
02
        'Converts Checkboxs to yes or no
03
        Dim ahodStat As String
04
        If chkAhod.CheckState = CheckState.Checked Then
05
            ahodStat = "Yes"
06
        ElseIf chkAhod.CheckState = CheckState.Unchecked Then
07
            ahodStat = "No"
08
        End If
09

10
        'Copies Info to Clipboard
11
        Clipboard.SetText("BTN: " + txtWtn.Text + Environment.NewLine +
12
                          "Acct Name: " + txtAcctName.Text + Environment.NewLine +
13
                          "Spoke With: " + txtSpokeWith.Text + Environment.NewLine +
14
                          "Verified: " + cboVerified.Text + Environment.NewLine +
15
                          "Email: " + txtEmail.Text + Environment.NewLine +
16
                          "Issue: " + txtIssue.Text + Environment.NewLine +
17
                          "AHOD: " + ahodStat)
18
    End Sub

Iknow I have to put a ToStringsomewhere I just cant figure out where.

The easiest way to convert is

ahodStat = IIf(chkAhod.Checked, "Yes", "No")

in which case your code could be simplified to

Private Sub btnCopyNotes_Click(sender As Object, e As EventArgs) Handles btnCopyNotes.Click

    'Copies Info to Clipboard

    Clipboard.SetText("BTN: " + txtWtn.Text + Environment.NewLine +
        "Acct Name: " + txtAcctName.Text + Environment.NewLine +
        "Spoke With: " + txtSpokeWith.Text + Environment.NewLine +
        "Verified: " + cboVerified.Text + Environment.NewLine +
        "Email: " + txtEmail.Text + Environment.NewLine +
        "Issue: " + txtIssue.Text + Environment.NewLine +
        "AHOD: " + IIf(chkAhod.Checked, "Yes", "No"))

End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.