Question:

How to put a quotation mark in a Text String in Visual Basic Programing ?

by Guest31694  |  earlier

0 LIKES UnLike

hi

I'm facing a trouble and that is I can not put the quotation mark ( " ")

in a Text string in Vb for example imagine we have a Text box object in our form and we want to make that form to do this action:

=================

exampletext = text1.text

maintext = " " " + exampletext + " " "

msgbox(maintext)

==================

this is easy but how can I make my program to alert a message like this ( with quotation mark)

"Hello World"

(note that the quotation mark must be included without needing writing extra quotation marks like example above)

Is there a solution?

thnks you

 Tags:

   Report

4 ANSWERS


  1. Sorry I can't be of complete help but I do remember there is commands such as /n (For a new line) and /t for tabs I believe when using Console.Write and WriteLine commands. Maybe you could look into this??


  2. This will not work...

    =================

    exampletext = text1.text

    maintext = " " " + exampletext + " " "....the +'s should be &

    msgbox(maintext)

    ==================

    Cut and paste this into the code pane on a blank form Form.Load event

    It's for  VB6 it uses the message box (MsgBox). Use the InputBox for a users inut:

    Dim MyVar

    MyVar = MsgBox("Hello World!", 65, "MsgBox Example")  ' MyVar contains either 1 or 2,

                                                          ' depending on which button is

                                                          ' clicked.

    VB2008 and Express and again Cut and paste this into the code pane on a blank form Form.Load event:

    Public Class Form1

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

            Dim msg As String

            Dim title As String

            Dim style As MsgBoxStyle

            Dim response As MsgBoxResult

            msg = "Do you want to continue?"   ' Define message.

            style = MsgBoxStyle.DefaultButton2 Or _

               MsgBoxStyle.Critical Or MsgBoxStyle.YesNo

            title = "MsgBox Demonstration"   ' Define title.

            ' Display message.

            response = MsgBox(msg, style, title)

            If response = MsgBoxResult.Yes Then   ' User chose Yes.

                ' Perform some action.

            Else

                ' Perform some other action.

            End If

        End Sub

    End Class

    : )

  3. From Microsoft a page with almost exactly the same title as your question (google is your friend)

    http://msdn.microsoft.com/en-us/library/...

  4. put double quotes next to each .  Like this:

    TextBox1.Text = "You said, ""Hello World!"" "

Question Stats

Latest activity: earlier.
This question has 4 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions