已答复 Code or HTML Issue?

  • Thursday, August 16, 2012 8:20 PM
     
      Has Code

    Im not sure if my HTML is wrong or my code is wrong. I'm trying to setup code to make it create a check  box. The code looks right to me but Im newb.

    Private Sub btnAddCheckbox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddCheckbox.Click
            Dim cbName As String
            Dim cbValue As String
            Dim cbText As String
            cbName = InputBox("Please Enter The Check Box Name", "Check Box", , , )
            cbValue = InputBox("Please Enter The Check Box Value", "Check Box", , , )
            cbText = InputBox("Please Enter The Check Box Text", "Check Box", , , )
            rtbHTMLCode.AppendText("<div>" & vbCrLf)
            rtbHTMLCode.AppendText("<form action=" & Chr(34) & Chr(34) & vbCrLf)
            rtbHTMLCode.AppendText("<input type=" & Chr(34) & "checbox" & Chr(34) & " name=" & Chr(34) & cbName & Chr(34) & " value=" & Chr(34) & cbValue & Chr(34) & "/>" & cbText & vbCrLf)
            rtbHTMLCode.AppendText("</form>" & vbCrLf)
            rtbHTMLCode.AppendText("</div>")
        End Sub

    It will display the text but not the check box in my HTML previewer. Is my VB code wrong or my HTML Code?

All Replies

  • Thursday, August 16, 2012 8:24 PM
     
      Has Code

    Adjusted code a little I was missing the k in checkbox but still not working here is updated code:

    Private Sub btnAddCheckbox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddCheckbox.Click
            Dim cbName As String
            Dim cbValue As String
            Dim cbText As String
            cbName = InputBox("Please Enter The Check Box Name", "Check Box", , , )
            cbValue = InputBox("Please Enter The Check Box Value", "Check Box", , , )
            cbText = InputBox("Please Enter The Check Box Text", "Check Box", , , )
            rtbHTMLCode.AppendText("<body>" & vbCrLf)
            rtbHTMLCode.AppendText("<form action=" & Chr(34) & Chr(34) & vbCrLf)
            rtbHTMLCode.AppendText("<input type=" & Chr(34) & "checkbox" & Chr(34) & " name=" & Chr(34) & cbName & Chr(34) & " value=" & Chr(34) & cbValue & Chr(34) & "/>" & cbText & vbCrLf)
            rtbHTMLCode.AppendText("</form>" & vbCrLf)
            rtbHTMLCode.AppendText("</body>")
        End Sub

  • Thursday, August 16, 2012 8:26 PM
     
     Answered Has Code

    Fixed it omg I was missing a ">" wow

     Private Sub btnAddCheckbox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddCheckbox.Click
            Dim cbName As String
            Dim cbValue As String
            Dim cbText As String
            cbName = InputBox("Please Enter The Check Box Name", "Check Box", , , )
            cbValue = InputBox("Please Enter The Check Box Value", "Check Box", , , )
            cbText = InputBox("Please Enter The Check Box Text", "Check Box", , , )
            rtbHTMLCode.AppendText("<body>" & vbCrLf)
            rtbHTMLCode.AppendText("<form action=" & Chr(34) & Chr(34) & ">" & vbCrLf)
            rtbHTMLCode.AppendText("<input type=" & Chr(34) & "checkbox" & Chr(34) & " name=" & Chr(34) & cbName & Chr(34) & " value=" & Chr(34) & cbValue & Chr(34) & "/>" & cbText & vbCrLf)
            rtbHTMLCode.AppendText("</form>" & vbCrLf)
            rtbHTMLCode.AppendText("</body>")
        End Sub

    • Marked As Answer by old_School Thursday, August 16, 2012 8:26 PM
    •  
  • Monday, August 20, 2012 9:52 AM
    Moderator
     
     
    Glad to see you have found solution  and thanks for sharing.
    Best regards,

    Shanks Zen
    MSDN Community Support | Feedback to us