i'm using visual c++ 2005 and in windows forms app how do i store a respond of a MSG box...
the methods given in both MSDN new and the web mSDN doesn't seem to be working.if they worked in ur machine tell me the procedure i have to follow....plz help me

Recommended Answers

All 4 Replies

Look at your vbresult function for messageboxes. It allows you to capture the button event procedure and know what button(s) the user has pressed and based on this you can you a logic statement, i.e. If Then Else statement

VC++ question in VB.NET forum you may move your thread to get more answers http://www.daniweb.com/forums/forum8.html Show method for MessageBox in C# returns DialogResult within you can know user selection (Yes, No, Abort, ....) I don't know if VC++ has the same scenario or not, I recommend to ask VC++ professionals.

this forum for vb.net friend :)

Hey, wel i am not 100% how to do this, using Visual C++, but if you know any way to change to Visual Basic, I can help, well its prety simple,

Add a 'TextBox', and a 'Button'

Make sure the textbox is called 'Textbox1'
That should be its default name anyway.

Double click on the button, then add this code.

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim SaveF As New System.IO.StreamWriter("PUT A PATH WHERE YOU WANT THE TXT FILE TO APEAR, HERE")
        SaveF.Write(TextBox1.Text)
        SaveF.Close()
    End Sub

So basicly, this is a simple way to send Text, from a textbox, to another location on your PC. It will automaticly create the text file. So here is a real example you could use.

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim SaveF As New System.IO.StreamWriter("C:\ExampleFolder\Textfile.txt")
        SaveF.Write(TextBox1.Text)
        SaveF.Close()
    End Sub

So this is an example you could use. It's all about choosing the correct path where you want the file to go. I hope this helps, although it used Visual Baisc and not C++.

Feel free to experiment with this example and have fun :)

x

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.