It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

New member has a question

Moderator: dafunkymunky

New member has a question

Postby wwr82 on Sat Oct 11, 2008 4:46 pm

Currently, I'm taking my first VB class in college. I'm not looking for homework help, I've already completed the assignment. However I do have a question that hopefully someone can answer.

I had to design and code a simple application where the user would enter a number of pennies say 330 in a text box, click submit, then the results would be displayed in a message box something like this: "330 pennies converts to:" the result would be broken down into the number of dollars, halves, quarters, etc... all the way to pennies.

I created a string message, and built it up over a series of steps to get it the way I wanted, then included it into the MessageBox.Show command to display it. MessageBox.Show(strMessage, "Conversion Results", MessageBoxButtons.OK , MessageBoxIcon.Information)

The program works fine, but my question is this: The message box using 330 pennies would say: "330 pennies converts to:" Is there a code that I can put in the string message that will use whatever numeric value the user places in the textbox? The program was created using VB2005. Thanks.
wwr82
 
Posts: 2
Joined: Sat Oct 11, 2008 2:41 pm

Postby fifarunnerr on Sat Oct 11, 2008 5:14 pm

What you exactly want to do?

Can you put some more codes?
fifarunnerr
 
Posts: 7
Joined: Sun Sep 21, 2008 10:20 am

Postby wwr82 on Sat Oct 11, 2008 7:15 pm

Actually, I figured it out. In the beginning I used TryParse and did this:Int32.TryParse(txtTotalPennies.Text , intTotalPennies)

I had previously declared Dim strmessage As string. After converting my data, all I had to add was strMessage = intTotalPennies.ToString () & "Pennies converts to:"

This allows the initial value entered in the textbox placed in the message box. Thanks for the reply.
wwr82
 
Posts: 2
Joined: Sat Oct 11, 2008 2:41 pm


Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests