Hi,
i want to accept data from user in messagebox using a variable. and later i want to use that variable. please help me.

Hi,
i want to accept data from user in messagebox using a variable. and later i want to use that variable. please help me.

If MessageBox.Show("Do you want to save the data", "Save", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
do what you want
Else
do what you want
End If

Sory. i think im wrong.

Dim button As DialogResult

        button = MessageBox.Show _
        ("Are you sure you want to exit this application?", _
        "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1)

        If button = Windows.Forms.DialogResult.Yes Then
            Me.Close()
        Else
            'Do Nothing
        End If

If MessageBox.Show("Do you want to save the data", "Save", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
do what you want
Else
do what you want
End If

amazing common sense man... i was struggling over the msgbox result for hours

Hi,
i want to accept data from user in messagebox using a variable. and later i want to use that variable. please help me.

Use inputbox() buddy

create new form

public str as string
dim f1 as form 

form = new inputform()
'input form you must create it ,put question,textbox,buttons on it 

inputform.showdialog()

'inside click button event in input form ,save the value of the textbox in str public variable

'than use str , it contains the value of textbox
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.