The Glade 4.0 https://gladerebooted.net/ |
|
And it did not kill me.... (VB) https://gladerebooted.net/viewtopic.php?f=5&t=5857 |
Page 1 of 1 |
Author: | darksiege [ Wed Mar 30, 2011 8:54 pm ] |
Post subject: | And it did not kill me.... (VB) |
This chapter in class was Structure and Arrays. I have been messing with this one for about two days trying to figure this out. I ran into a small problem where I was finding that the line Code: ReceivingLists(NumberTransactionsInteger).BandName = BandNameComboBox.SelectedIndex was screwing me up and all of my stuff was displaying the index number instead of the band name... so I switched it to Code: ReceivingLists(NumberTransactionsInteger).BandName = BandNameComboBox.Text and my problem was solved. The program is currently working almost as intended, the only thing I still cannot figure out how to do is change the printing from a printed page and into a text window within the program itself. AND... When trying to print the report, it started displaying everything that is in the array and then also adding lines for the newly received items. It was working and just stopped. AAAAAAAAAAAHHHHHH! Spoiler: |
Author: | Lex Luthor [ Wed Mar 30, 2011 9:04 pm ] |
Post subject: | |
Well right now it's drawing graphics by converting text into pixels. Instead you want to make it print pure ASCII into a text field? You say it stopped working... what happens now when you run it? |
Author: | darksiege [ Wed Mar 30, 2011 9:07 pm ] |
Post subject: | Re: |
Lex Luthor wrote: You say it stopped working... what happens now when you run it? As far as the ASCII thing, I am trying to get it to put the same thing it would be printing onto the form itself, If it must be done in ASCII, then yes. I attempted to use the Print Preview Control (instead of the Dialog) and it told me to bugger off. EDIT: Okay so I figured out the printing everything even if the qty was 0.... I just changed the line from Code: For Each IndividualAlbumReceive As ReceivingInfo In ReceivingLists ' Don't print if Blank If IndividualAlbumReceive.BandName <> "" Then to Code: For Each IndividualAlbumReceive As ReceivingInfo In ReceivingLists ' Don't print if Blank If IndividualAlbumReceive.QuantityReceived > 0 Then and it began to work as intended, sans the printing/text thing. |
Author: | Lex Luthor [ Wed Mar 30, 2011 9:26 pm ] |
Post subject: | |
It seems first of all you are overwriting the first 5 entries in the pre-existing list with your newly typed stuff when you click the button, instead of putting the new entries at the end of the pre-existing list. You might want to re-design this, although I could be interpreting the code wrong. If you only want to print the new items then keep a new counter in the For loop in PrintPage. At the end of the loop just have counter += 1. When counter => NumberTransactionsInteger, break out of the for loop. If you haven't done this before I think the keyword is just "break". To print these out in a text field, you need to define a string such as "FullPageText" or something and set its value to "". Right after anywhere with e.Graphics.DrawString, you need to concatenate either BandName, AlbumName, or FormattedQuantity into this string with a new line. Something like: FullPageText = FullPageText & IndividualAlbumReceive.BandName & "\t\t\t" FullPageText = FullPageText & IndividualAlbumReceive.AlbumName & "\t\t\t" FullPageText = FullPageText & FormattedQuantity & "\n\n" Note: "\t" is for a tab and "\n" is for a new line, in case you didn't know. Have a big textfield (or label) called BigTextfield or something. After the for loop finishes just do BigTextfield.text = FullPageText. I hope I make some sort of sense. edit: I see what you mean with quantity received... just disregard my first two paragraphs I guess. Using quantity received seems like the best way to do what you want. |
Author: | darksiege [ Wed Mar 30, 2011 11:08 pm ] |
Post subject: | |
that does make sense, thank you... now if I did not want it to do a print preview at all, and just do the display on the text box, how would I need to modify it? I have tried a few variations and they all hate me. |
Author: | Lex Luthor [ Wed Mar 30, 2011 11:09 pm ] |
Post subject: | Re: |
darksiege wrote: that does make sense, thank you... now if I did not want it to do a print preview at all, and just do the display on the text box, how would I need to modify it? I have tried a few variations and they all hate me. The fastest and fool-proof way to do this is to comment out any line that has "e.Graphics.DrawString" |
Author: | darksiege [ Wed Mar 30, 2011 11:14 pm ] |
Post subject: | Re: Re: |
Lex Luthor wrote: The fastest and fool-proof way to do this is to comment out any line that has "e.Graphics.DrawString" I kind of did that by putting the for loop in the Display button code (second appearance in the code), and leaving the print document option only in the exit button. I was about to delete the comment but you had already replied. |
Page 1 of 1 | All times are UTC - 6 hours [ DST ] |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |