Results in a textbox instead of message Box

pearses

New member
Joined
Oct 30, 2007
Messages
4
Programming Experience
Beginner
Hey,

Hopefully this should be simple enough for someone to help with.

I am writing a simple program to do a couple of calculations. I have got this far by doing tutorials.

My program does a calculation and puts the result in a external Message box. How do I change it so the result will appear on the same form?

Here is a section of code:

VB.NET:
 Select Case A

            Case A = 0 To 99.99

                MsgBox(L)


            Case A = 100 To 499.99

                If CheckBox1.Checked = False Then
                    MsgBox(B & " " & vbCrLf & vbCrLf & C & A * 0.9)

                Else
                    MsgBox(B & " " & vbCrLf & M & vbCrLf & vbCrLf & C & A * 0.875)
                End If

As you can see its very simple stuff but I dont like the way it shows me the result in an external pop-up box.

I would like to create a text box at the bottom of my form which displays the answer when I click the button for result.

Any help with this would be greatly appreciated.

Thanks All!! :D
 
Add a textbox to your form and name it "resultsTextBox"

now in your code whereever you see "MsgBox(" put in "resultsTextBox.Text = " and remove the last ")"

VB.NET:
Select Case A

            Case  0 To 99.99

                resultsTextBox.Text = L


            Case 100 To 499.99

                If CheckBox1.Checked = False Then
                    resultsTextBox.Text = B & " " & vbCrLf & vbCrLf & C & A * 0.9

                Else
                    resultsTextBox.Text = B & " " & vbCrLf & M & vbCrLf & vbCrLf & C & A * 0.875
                End If

you'll also need to set the textbox's MultiLine property to True
 
I have another query if anyone could give me a hand.

How do you transfer from one form to another, for instance, if I have a menu page first and you have to click a button to take you through to main program.

Again I would like to keep everything in one frame.

I know a bit of html and suppose Im thinking in terms of clicking a button and it having a link attached to it. How is this achieved?

Again thanks for any help.
 
Is this an ASP.Net project? or a Windows Form project?

If it's an asp project, you can use cookies or application and session variables. If it's a windows project, you can pass information directly to the new form or store it in a global variable or a class that's global to the project.
 
Forms

I dont actually want to pass information. It is a windows project.

All I want to create really is a welcome page which has a link through to the main form, like a hyperlink in html.

Then maybe put a button on the main form back to the welcome page. I would like to keep everything in the one frame.

I would also use this button to open up a new broswer window - but over the top of the original frame.

I hope I am explaining this ok.

Thanks again
 
Back
Top