Results 1 to 29 of 29

Thread: Creating a Message Box with Column Headings and Columns?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2010
    Posts
    16

    Creating a Message Box with Column Headings and Columns?

    I'm trying to create a message box that shows a column for Years, represented by 0-10, and an amount, as a $ wise decimal in another column.

    I was wondering how to create a multi column message box with column headings o.o.

    Thanks!

  2. #2
    Lively Member
    Join Date
    Sep 2009
    Location
    Florida
    Posts
    75

    Re: Creating a Message Box with Column Headings and Columns?

    Are you really talking about a Message Box ... or some sort of List Box with columns?
    "The most important quality a programmer must have is persistence."

  3. #3
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Creating a Message Box with Column Headings and Columns?

    Sounds like a ListView in Report View or a Grid control to me.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Mar 2010
    Posts
    16

    Re: Creating a Message Box with Column Headings and Columns?

    Yeah it says that it will show the data in a message box, with two columns, one for year and one for amount on deposit.

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Creating a Message Box with Column Headings and Columns?

    You'll need to create a form with the list view or grid on it... there isn't a way to use the built-in MessageBox...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Creating a Message Box with Column Headings and Columns?


    The attached is a form that looks like a MsgBox. Just add a litview control to it and you'll have what you want. If you don't need the "don't show this again" code then remove it.
    Attached Files Attached Files

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Mar 2010
    Posts
    16

    Re: Creating a Message Box with Column Headings and Columns?

    I don't think were allowed to use another form though, and I can't open those files, I'm using microsoft visual studio 2008?

    The whole assignment is to calculate interest over 10 years, and have it display the totals for all 10 years in a message box. With one column with years 1-10, and the other column with the totals for each corresponding year. Is there anyway to do this with a list box? I'm using for next loop.

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Mar 2010
    Posts
    16

    Re: Creating a Message Box with Column Headings and Columns?

    I got the calculation part to work but I dont know how to get the message box to look like hers does...

  9. #9
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Creating a Message Box with Column Headings and Columns?

    You need to post in a VB.Net forum. This one is for traditional Visual Basic.

  10. #10
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Creating a Message Box with Column Headings and Columns?

    Thread moved from 'VB6 and Earlier' forum to 'VB.Net' (VB2002 and later) forum

  11. #11

    Thread Starter
    Junior Member
    Join Date
    Mar 2010
    Posts
    16

    Re: Creating a Message Box with Column Headings and Columns?

    Do I have to use some sort of array? But the message box has to have "Years" and "Amount on deposit" as the column headings, followed by the 1-10 under "Years', and a Decimal Amount under "Amount on deposit". I'm so clueless

  12. #12
    Fanatic Member Megalith's Avatar
    Join Date
    Oct 2006
    Location
    Secret location in the UK
    Posts
    879

    Re: Creating a Message Box with Column Headings and Columns?

    you can create columns in a msgbox, you need to use a system font (one where the letter W will take the same space as a letter I) and you need to fill each field with spaces to a fixed amount then you can do something like
    Code:
    Year      | Amount
    2000      |$1234.56
    2001      |$5643.21
    2002      |$2222.22
    so you create an array with 2 dimensions and 10 elements
    [code]
    Dim Deposits(10,1) As String
    [code]
    then you need to fill the values for the array( not forgetting the header in (0,0) and (0,1), then use a loop and add spaces to make the columns the size (in chars) you need. once you have done this you create a string using a loop like this
    Code:
    Dim FinalString as String = ""
    for a = 0 to 10
        FinalString &= deposits(a,0) & "|" & Deposits(a,1) & VbCrLf
    Next a
    Finally you display this string in the msgbox
    Code:
    MsgBox(FinalString)
    Hope this helps
    If debugging is the process of removing bugs, then programming must be the process of putting them in.

  13. #13
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Creating a Message Box with Column Headings and Columns?

    And how do you control the font used by the msgBox?
    Isn't that controlled by the system?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  14. #14
    Fanatic Member Megalith's Avatar
    Join Date
    Oct 2006
    Location
    Secret location in the UK
    Posts
    879

    Re: Creating a Message Box with Column Headings and Columns?

    Quote Originally Posted by techgnome View Post
    And how do you control the font used by the msgBox?
    Isn't that controlled by the system?

    -tg
    I believe it is a system font anyway. which i guess is why it is used for this exercise.

    Edit: just checked it isn't :s
    If debugging is the process of removing bugs, then programming must be the process of putting them in.

  15. #15

    Thread Starter
    Junior Member
    Join Date
    Mar 2010
    Posts
    16

    Re: Creating a Message Box with Column Headings and Columns?

    After messing around for the past 2 hours i came up with this.....seems way to complicated but it works...>_>




    Is there any easier way to do this? lmaooo -_-
    Last edited by AsianTiffany; Mar 17th, 2010 at 06:08 PM.

  16. #16
    Fanatic Member Megalith's Avatar
    Join Date
    Oct 2006
    Location
    Secret location in the UK
    Posts
    879

    Re: Creating a Message Box with Column Headings and Columns?

    nice, forgot about the Tab and good you used environment.newline rather than vbcrlf which is the preferred .net way of doing a newline.
    If debugging is the process of removing bugs, then programming must be the process of putting them in.

  17. #17

    Thread Starter
    Junior Member
    Join Date
    Mar 2010
    Posts
    16

    Re: Creating a Message Box with Column Headings and Columns?

    Ok now I have some seriously wierd problem. No matter what I change on the program, when I run it, it appears and runs as if I did nothing. I can delete all of the lines of code for the each year button press, and save it and run it, and it still works perfectly...

    Like I can literally delete all of the code, save it, and run it and it will still run perfectly fine....*** -_-

    Which is making it impossible for me to create the code for the every three years button, considering no matter what the changes I make in the code don't seem to reflect anything when I run it...

    any ideas?

  18. #18
    Fanatic Member Megalith's Avatar
    Join Date
    Oct 2006
    Location
    Secret location in the UK
    Posts
    879

    Re: Creating a Message Box with Column Headings and Columns?

    you can replace
    Code:
    InformationString = "Year" & ControlChars.Tab & "Amount on deposit" & Environment.NewLine _
                   & YearsInteger(1).ToString("N0") & ControlChars.Tab & AmountDecimal(1).ToString("C") & Environment.NewLine _
                   & YearsInteger(2).ToString("N0") & ControlChars.Tab & AmountDecimal(2).ToString("C") & Environment.NewLine _
                   & YearsInteger(3).ToString("N0") & ControlChars.Tab & AmountDecimal(3).ToString("C") & Environment.NewLine _
                   & YearsInteger(4).ToString("N0") & ControlChars.Tab & AmountDecimal(4).ToString("C") & Environment.NewLine _
                   & YearsInteger(5).ToString("N0") & ControlChars.Tab & AmountDecimal(5).ToString("C") & Environment.NewLine _
                   & YearsInteger(6).ToString("N0") & ControlChars.Tab & AmountDecimal(6).ToString("C") & Environment.NewLine _
                   & YearsInteger(7).ToString("N0") & ControlChars.Tab & AmountDecimal(7).ToString("C") & Environment.NewLine _
                   & YearsInteger(8).ToString("N0") & ControlChars.Tab & AmountDecimal(8).ToString("C") & Environment.NewLine _
                   & YearsInteger(9).ToString("N0") & ControlChars.Tab & AmountDecimal(9).ToString("C") & Environment.NewLine _
                   & YearsInteger(10).ToString("N0") & ControlChars.Tab & AmountDecimal(10).ToString("C") & Environment.NewLine
    with
    Code:
    InformationString = "Year" & ControlChars.Tab & "Amount on deposit" & Environment.NewLine
    for a as integer = 1 to 10
        informationString &= YearsInteger(a).ToString("N0") & ControlChars.Tab & AmountDecimal(a).ToString("C") & Environment.NewLine
    next
    If debugging is the process of removing bugs, then programming must be the process of putting them in.

  19. #19

    Thread Starter
    Junior Member
    Join Date
    Mar 2010
    Posts
    16

    Re: Creating a Message Box with Column Headings and Columns?

    Nvm, apparently I had the thingy set to "debug" and I changed it to "release" and it worked.

  20. #20

    Thread Starter
    Junior Member
    Join Date
    Mar 2010
    Posts
    16

    Re: Creating a Message Box with Column Headings and Columns?

    Haha yes, that does make it look a lot cleaner, thanks (:
    Last edited by AsianTiffany; Mar 17th, 2010 at 06:08 PM.

  21. #21
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: Creating a Message Box with Column Headings and Columns?

    Draw up a Dialog Box using the Form drawing box, and then use the Label controls or the TextBoxes to draw up a table. Or even use something like an Access table control or even an Excel table worksheet conrtrol, even...

    I have been able to make a table control, using only Label controls. This means that you can fill up the data that is to be filled into them, using the max length and the position of the control. That coninsided with the position on the Form. This was then adapted to my Warhammer 40,000 wargame. That I was making for me, and my friends on my community network on the Internet, but never got around to finishing it, really!!
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  22. #22
    Lively Member
    Join Date
    Feb 2010
    Posts
    120

    Re: Creating a Message Box with Column Headings and Columns?

    You could make a dialog box
    and get the data like this

    Code:
    Me.textbox1.Text = Form1.Textbox1.Text

  23. #23
    Lively Member
    Join Date
    Sep 2009
    Location
    Florida
    Posts
    75

    Re: Creating a Message Box with Column Headings and Columns?

    Should we really be doing her homework for her?
    "The most important quality a programmer must have is persistence."

  24. #24
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: Creating a Message Box with Column Headings and Columns?

    Well as long as we are teaching her. And not doing it for her. But she will only be able to do it, if we are able to show her, how to do it. Because she will never learn in the short term.
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  25. #25
    Lively Member
    Join Date
    Sep 2009
    Location
    Florida
    Posts
    75

    Re: Creating a Message Box with Column Headings and Columns?

    Well, IMHO a little guidance is okay, but teaching is what the school is for.
    "The most important quality a programmer must have is persistence."

  26. #26
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Creating a Message Box with Column Headings and Columns?

    And if some of the posts here (at VBF in general, not specifically this thread) are any indication, whether what the schools call teaching is debatable.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  27. #27

    Re: Creating a Message Box with Column Headings and Columns?

    School only gets you so far sometimes.

  28. #28
    Lively Member
    Join Date
    Sep 2009
    Location
    Florida
    Posts
    75

    Re: Creating a Message Box with Column Headings and Columns?

    Sad but true
    "The most important quality a programmer must have is persistence."

  29. #29
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: Creating a Message Box with Column Headings and Columns?

    yes, that is true!!
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width