|
The only way I know of is iterating through the items, one by one, and creating a second 1-dimensional array.
|
|
|
|
|
Still thank you, Dave, for your answer.
|
|
|
|
|
Hello everyone,
I'm programming a web browser and I don't like it that my web browser actually runs from Internet Explorer instead of my application itself, is it possible for my web browser to have it's own proxy, "internet disconnected" page, I.p., etc. (like Google Chrome, Mozilla Firefox and Opera) I've had heard of Win Sock before, but I do not have extensive knowledge on that subject, but Am willing to learn anything you tell me (including Win Sock).
Simple Thanks and Regards,
Brandon T. H.
Been programming in Visual Basic for 4 years this point forward, and is very good at it (I can even create programs completely on code, without dragging those items from the toolbox). Programming C++ for 1 year so far and the same with C#.
Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison
|
|
|
|
|
You have to jump through some flamming hoops to get this to work. You can see an example of it here[^].
Basically, the Web Browser control is a managed wrapper for whatever version of IE is install on your machine. Since you're running IE in a window, it'll use all the settings you set in IE, unless you smash the Web Browser control with a large hammer.
|
|
|
|
|
|
|
OK thanks, but also I'm interested does exists some 3rd party program which will allow me to debugging remotely.
greetings
|
|
|
|
|
There is no such product. This is because, when running under the debugger, VB6 code is kind of interpreted, not compiled.
You can remotely debug a VB6 app, you just won't see VB6 source code. You'll see assembler, or in other cases, eqivilent C code, neither of which will resemble your original VB6 code in any way.
|
|
|
|
|
acects wrote: But I can not find anything about remote debugging in Visual Basic 6.0.
That might be due to the fact that most of us abandoned VB6. You'll get more support for Latin.
acects wrote: Is it possible at all?
Stick to OutputDebugString while you're in VB6.
Bastard Programmer from Hell
|
|
|
|
|
I have two reports, done with Crystal Reports, in my project currently. I'm forever having trouble with Crystal Reports and these problems are now causing deployment problems. I'm getting very tired of fighting thru the myriad of problems I've had with Crystal Reports and I want to explore the possibility, desirability of eliminating CR from my project altogether and producing these reports in a diffferent manner.
I would like to know what others have found best.
The reports that I currently have are pretty rudimentary. Just some simple formatting; no graphics, tables, colors, etc.
I know of three other possibilities; 1) using the Report capabilities of VS, 2) automating Word from VS, or 3) writing a text file from VS and then using Word VBA to manipulate it to produce the reports.
Do you know of any others?
Of the options that I've thought of; keeping Crystal Reports, Microsoft Reporting Services, automating Word, and passing a text file to Word; would you consider any of these to be superior to the others? Which way should I go?
I don't know how to do any of these ways. I will have to learn. So, the difficulty, or ease, of the learning process is definitely a consideration.
Any advice or words of wisdom that you might have for me would be greatly appreciated. Thank you.
|
|
|
|
|
I use Reporting Services. It's not much different than Crystal Reports, but I found it far more stable.
Automating Word is about the worst thing you could possibly do to generate a report.
No, scratch that. Writing a text file, then using VBA in Word to create the report in Word is about the worst thing you could do.
|
|
|
|
|
Thank you Dave. You gave me just what I needed and I appreciate it. Another person advised me to use Reporting Services and that is now what I intend to do. I've got some 'book learning' to do but I'm now ready to go. You saved me from going down the wrong road. Thanks. Jack
|
|
|
|
|
I don't know exactly what you're trying to accomplish but I never ever use Crystal Reports. Controlling the printer (in VB 6 at least) is a very simple process.
dim something as stdfont to allow you to change fonts and their characteristics during the run (Don't use the printer font properties for this they don't work well) stdfont is a standard type supplied in VB 6.
Open the printer
set the fonts in the something variable
position the printer cursor using printer.currentx and printer.currenty
Line spacing (kerning) is determined by the font, of course. You can use printer.currenty to override that.
dump the text using printer.print "sometext" If you want all the output on the same line then add a ; (printer.print "sometext";) and you can avoid the printer.currenty statement.
and repeat.
If you're printing a columnar report, add a test to determine end of page (the printer dimensions are twips) I usually leave 1/2" = 720 twips of air @ the bottom to allow for the different unprintable areas
printer.newpage ejects the page
end the job with printer.enddoc
abort using printer.killdoc
If the output exceeds 1 page you'll probably want to have a heading procedure. Printer.page tells you the page number that you can add to your report if you feel like it.
I have used this for over 10 years to print all kinds of reports including form filling.
Murray
|
|
|
|
|
Ben, thank you very much for this. I'm struggling to say the least. I do want to get Crystal Reports out of my life and the way you outline seems like a very real possibility for me. If I understand it correctly it seems so much easier than Crystal Reports or Reporting Services. I'm going to give it a try right away. Would it be possible for you to send me a code snippet? Maybe just a "Hello World" report that said nothing more than that. In the meantime I'm going to try to do it myself. I've got users waiting on me and I'm currently DIW. Dead in the water. I don't need different fonts but I will need to bold some text. Thanks Ben. Jack
|
|
|
|
|
Ben, hold on that request for a code snippet. I found an article and some code. The way I understand it, and will try it later, is to have a form and add to it a PrintDocument control to the form. Then I will have access to statements like the ones you gave to me. I'm looking forward to trying this out. Thanks. jack
|
|
|
|
|
I don't use a PrintDocument control either. Just the printer.
Here's a complete sub we currently use
Public Sub PrintMaintenanceRenewalLetters( _
rsIn As ADodb.Recordset, _
PayDOSCustomersIn() As String, _
DoingReminderIn As Boolean, _
Optional StartFromIn As Integer = 1, _
Optional Recs2Print As Integer = 9999, _
Optional CustNumberIn As String = "-X")
Dim CustNoHold As String
Dim LastLine As Single
Dim iCtr As Integer
Dim StateTablesBought As Integer
Dim CDAdder As Currency
Dim ExtPrice As Currency
Dim ExtFreight As Currency
Dim SalesTax As Currency
Dim QtyBought As Long
Dim BkMark As Variant
' Const FED_PART_NO As String = "87FEDST-03"
' Const FED_DESCRIPTION As String = "Tax Table Service Fed + 1 State"
' Const FED_PRICE As Currency = 45#
' Const OLD_FED_PART_NO As String = "87003-04"
Const FREIGHT_CHARGE As Currency = 3.95
LastLine = Printer.Height - 1440
Dim Ctr As Integer
Ctr = 0
CustNoHold = ""
If StartFromIn > 1 Then
Do
If Trim(rsIn![Customer_Number]) <> CustNoHold Then
CustNoHold = Trim(rsIn!Customer_Number)
Ctr = Ctr + 1
End If
rsIn.MoveNext
Loop Until Ctr = StartFromIn
rsIn.MoveNext
CustNoHold = ""
ElseIf CustNumberIn <> "-X" Then
Do
If Not rsIn.EOF Then
rsIn.MoveNext
If rsIn.EOF Then Exit Do
End If
Loop Until (Trim(rsIn![Customer_Number]) = CustNumberIn) Or rsIn.EOF
If rsIn.EOF Then
MsgBox "Customer Number " & CustNumberIn & " not found!", vbCritical + vbOKOnly, "Error"
Exit Sub
End If
CustNoHold = ""
End If
Do
Do
If Trim(rsIn![Customer_Number]) <> CustNoHold Then
If CustNoHold <> "" Then
' Print the CD adder
Printer.FontBold = True
Printer.ForeColor = vbRed
Printer.Print
Printer.CurrentX = DESCRIPTION_LEFT
Printer.Print "____";
Printer.CurrentX = DESCRIPTION_LEFT + 450
Printer.Print "Please send my services on a CD"
Printer.CurrentX = DESCRIPTION_LEFT + 450
Printer.Print "instead of by e-mail."
Printer.CurrentX = DESCRIPTION_LEFT + 450
Printer.Print "I am adding " & Format(CDAdder, "currency") & " to the Total Price."
Printer.ForeColor = vbBlack
' Print the totals
m_TotalFreight = 0
Printer.CurrentY = m_Line1Y
Printer.CurrentX = RightJustify(Format(m_TotalPrice, "currency"), Printer, 10000)
Printer.Print Format(m_TotalPrice, "currency")
If InStr(CustomerLabel.CityStZip, " AZ ") Then
SalesTax = RoundPerIRS(CCur(m_TotalPrice * SALES_TAX_RATE))
Printer.CurrentY = m_Line2Y
Printer.CurrentX = RightJustify(Format(SalesTax, "currency"), Printer, 10000)
Printer.Print Format(SalesTax, "currency")
End If
' Printer.CurrentY = m_Line3Y
' Printer.CurrentX = RightJustify(Format(m_TotalFreight, "currency"), Printer, 10000)
' Printer.Print Format(m_TotalFreight, "currency")
'
Printer.CurrentY = m_Line4Y
Printer.CurrentX = RightJustify(Format(m_TotalPrice + SalesTax + m_TotalFreight, "currency"), Printer, 10000)
Printer.Print Format(m_TotalPrice + SalesTax + m_TotalFreight, "currency")
Printer.FontBold = False
If CustNoHold = CustNumberIn Then
Printer.EndDoc
rsIn.Close
Exit Sub
Else
Printer.NewPage
End If
End If
If LoadCustomerLabel(rsIn!Customer_Number) Then
m_TotalPrice = 0
CDAdder = 0
SalesTax = 0
m_TotalFreight = 0
StateTablesBought = 0
' Print either the IS or PAYROLL order
If DoingReminderIn Then
PrintRenewalReminderOrderForm
Else
PrintRenewalOrderForm
End If
m_Line5Y = 10100
CustNoHold = Trim(rsIn!Customer_Number)
Printer.FontSize = 9
Printer.Font = "Arial"
Printer.CurrentX = LETTER_LEFT_MARGIN
Printer.CurrentY = 5.525 * 1440
Printer.Print CustomerLabel.Name
Printer.CurrentX = LETTER_LEFT_MARGIN
Printer.Print CustomerLabel.Company
Printer.CurrentX = LETTER_LEFT_MARGIN
Printer.Print CustomerLabel.Address; " "; CustomerLabel.Suite
Printer.CurrentX = LETTER_LEFT_MARGIN
Printer.Print CustomerLabel.CityStZip
Printer.CurrentX = LETTER_LEFT_MARGIN
Printer.Print CustomerLabel.Phone
Printer.ForeColor = vbRed
Printer.FontSize = 10
Printer.Font = "Arial"
Printer.CurrentX = LETTER_LEFT_MARGIN
If InStr(CustomerLabel.eMail, ";") Then
Printer.Print Left(CustomerLabel.eMail, InStr(CustomerLabel.eMail, ";") - 1)
Else
Printer.Print CustomerLabel.eMail
End If
Printer.ForeColor = vbBlack
Printer.CurrentY = m_Line5Y
End If
End If
Printer.FontSize = 8
Printer.CurrentX = QTY_LEFT
QtyBought = CLng(rsIn![Qty])
If IsNull(rsIn![Description]) Then
GoTo BadRecord
' MsgBox "Bad record. Item Number " & rsIn!Item_Number & " has no description. Aborting", vbCritical + vbOKOnly
' Printer.EndDoc
' rsIn.Close
' Exit Sub
Else
Printer.Print QtyBought;
Printer.CurrentX = ITEM_NUMBER_LEFT
Printer.Print rsIn!Item_Number;
Printer.CurrentX = DESCRIPTION_LEFT
If Printer.TextWidth(Trim(rsIn![Description])) > 3600 Then
Printer.Print Left(rsIn![Description], 40) & ". . .";
Else
Printer.Print rsIn![Description];
End If
Printer.CurrentX = RightJustify(Format(rsIn![Retail], "currency"), Printer, m_lRgtOfList)
Printer.Print Format(rsIn![Retail], "currency");
ExtPrice = QtyBought * rsIn![Retail]
CDAdder = CDAdder + (QtyBought * CD_FEE)
' ExtFreight = QtyBought * FREIGHT_CHARGE
Printer.CurrentX = RightJustify(Format(ExtPrice, "currency"), Printer, m_lRgtOfDiscount)
Printer.Print Format(ExtPrice, "currency");
' Printer.CurrentX = RightJustify(Format(ExtFreight, "currency"), Printer, m_lRgtOfNet)
Printer.Print 'Format(ExtFreight, "currency")
m_TotalPrice = m_TotalPrice + ExtPrice
' m_TotalFreight = m_TotalFreight + ExtFreight
End If
BadRecord:
rsIn.MoveNext
Loop Until (Printer.CurrentY >= LastLine) Or rsIn.EOF Or g_lTotalRecordsPrinted = Recs2Print
If Not rsIn.EOF Then
Printer.NewPage
Else
m_TotalFreight = 0
' Print the totals
Printer.CurrentY = LastLine - 720
Printer.CurrentX = DESCRIPTION_LEFT
Printer.Print "____";
Printer.CurrentX = DESCRIPTION_LEFT + 450
Printer.Print "Please send my services on a CD instead of by e-mail."
Printer.CurrentX = DESCRIPTION_LEFT + 450
Printer.Print "I am adding " & Format(CDAdder, "currency") & " to the Total Price."
Printer.FontBold = True
Printer.CurrentY = m_Line1Y
Printer.CurrentX = RightJustify(Format(m_TotalPrice, "currency"), Printer, 10000)
Printer.Print Format(m_TotalPrice, "currency")
If InStr(CustomerLabel.CityStZip, " AZ ") Then
SalesTax = RoundPerIRS(CCur(m_TotalPrice * SALES_TAX_RATE))
Printer.CurrentY = m_Line2Y
Printer.CurrentX = RightJustify(Format(SalesTax, "currency"), Printer, 10000)
Printer.Print Format(SalesTax, "currency")
End If
' Printer.CurrentY = m_Line3Y
' Printer.CurrentX = RightJustify(Format(m_TotalFreight, "currency"), Printer, 10000)
' Printer.Print Format(m_TotalFreight, "currency")
Printer.CurrentY = m_Line4Y
Printer.CurrentX = RightJustify(Format(m_TotalPrice + SalesTax + m_TotalFreight, "currency"), Printer, 10000)
Printer.Print Format(m_TotalPrice + SalesTax + m_TotalFreight, "currency")
Printer.FontBold = False
End If
DoEvents
Loop Until rsIn.EOF Or (g_lTotalRecordsPrinted >= Recs2Print)
Printer.EndDoc
rsIn.Close
Note it doesn't use stdfont because I didn't need to change the fonts. In those cases, the printer properties work well.
Murray (not Ben)
|
|
|
|
|
I'm sorry about that Ben thing.
Murray, thanks much for this. I'm getting ready to try it in a few minutes. I have a feeling that VS 2010 does not like the printer. commands. I tried that before and got an error message. I think I may have to add the printDocument control. But I'll find out in just a few minutes. I'm going to take a form, add a button, and put your code into the button's click event. I'll comment out lines of code concering the recordset. If that doesn't work I may try the code in a subroutine inside of a module that I call. Anyway, I'm going to mess around with it and I'll let you know of progress, or lack thereof. Thank you Murray. Jack
|
|
|
|
|
Murray, I put a form in my project, added a button, and put the following code behind it's click event.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Printer.FontBold = True
printer.print("Hello World")
Printer.Print()
End Sub
End Class
It doesn't like the printer statements. It says it's undeclared. I must need a reference, an imports statement, or a declaration of some sort. Any ideas? jack
|
|
|
|
|
As I hope I mentioned I am a VB6 expert who has assiduously avoided the .NET realm so far. (I manage 435,000 lines of code that I do not want to convert). Although that will have to change.
I would have to assume that the printer object (if available) is defined in the System namespace.
Did you try
system.printer.print "Hello World"
If that doesn't work then I'm sorry but I'm out of ideas.
|
|
|
|
|
Thanks Murray. Unfortunately it did not work. It said printer was not a member of system. It's too bad it doesn't work as what you explained to me was something that I could understood and could work with. It is so simple; you want to print something you say 'print something'. Why they had to go and make things so much more complicated; I dunno.
435,000 lines of code; wow! I would not want your job. Good luck on it and when conversion time comes; good luck on that.
Thanks for your help Murray. I'm going to keep working on this and if I learn anything interesting I'll let you know. Jack
|
|
|
|
|
Any time, Jack.
You know there is another version of Basic that is procedural and hence much easier to use. It does have statements as easy as print something. I used it to produce 4 commercial products for 10 years.
It is called PowerBasic. www.powerbasic.com
I only stopped using it when I was forced to remake our products for Windows. It didn't have any GUI support at all in the beginning although it does now.
It also has a huge user community with tons of free code.
Happy Memorial Day.
Murray
|
|
|
|
|
Murray, thanks for this info and I'll definitely check it out.
I found a free e-book, see link below, on printing in VB 2010. I've read thru it and grabbed some code snippets and I think I'm going to be able to make it work for me.
Sometime when you're feeling really masochistic you should check it out. Microsoft makes things much harder than they need to be. For example:
Instead of print "sometext" it is e.graphics.drawstring("sometext")
I really don't care what it is just as long as I know what it is and I can use it. And, I have tried the e.graphics.d... and it works. MS is using VB graphics for printing. Okay, I guess I can get accustomed to that.
So, I'll stumble along this way and I'll also check out PowerTools. This is good to know. Thanks. Jack
http://www.filemount.com/2011/01/printing-with-visual-basic-2010/
|
|
|
|
|
Hi Jack,
Thanks for the link to the ebook.
Actually the process is pretty much as I described for VB 6, just with a lot more typing.
(When I was in school we used to say that COBOL was a horrible language to code in because of all the keyboarding involved. COBOL is a walk in the park compared to VB 10, even with intellisense.)
My products do payroll everywhere there is a US payroll and other government forms so you can just imagine the amount of reports we have to print.
The page you sent did have links to a couple of books you might find helpful.
Murray
|
|
|
|
|
Hi Murray,
I'm beginning to like this printing capability. I'm not very good at it yet but I do see the potential for good reports. It takes a lot of code and but most of it is understandable. Crystal Reports is an attempt to greatly simplify things. And although this sounds crazy they've made it so damn simple I can't understand it. I just have so much trouble with CR. With this language you can use simple VB constructs like 'if then else' and in CR they do have 'if then else' but it's really different. I would rather spend 3 days working on one report than even 10 minutes with CR. I know that after spending 3 days with VB I would have something; 3 days with CR and all I would end up with is a huge headache.
Someday I'm afraid you're gonna have to upgrade from VB 6. I hope not though. No one would want to do all the conversion work on your codebase. Here's a business opportunity. Write a program to do just the report conversions. I say 'just' as if this would be trivial; it certainly would not be. But, if you, or one of your co-workers could do it it would be worth something. Maybe it's already been done; I don't know.
That's fabulous that your products do work for the government. That is HUGE!! If a company could have only one customer that is the one they should want; the US Govt. This is very impressive.
I'm a retired Fed. I was a software developer there for 30 years. I worked on administrative systems to include accounting systems. I had co-workers that worked on payroll although I never did. I know some of the complexities though and I know there are many.
Keep the faith Murray. I'm gonna get back to work on these reports. In this methodology one has to line breaks, page breaks, etc. I like detail work though so I'm a happy camper.
Thanks Murray and happy Wed. to you. jack
|
|
|
|
|
Hi Jack,
You're so right about the detail work that it is capable of. I looked @ it some more and it is really nothing more than an extremely complicated version of what I use in VB 6. The abilities for placements, fonts, kerning, leading and so on are excellent. They do require attention to detail but, what non-trivial programming doesn't? Attention to detail is what separates the hacks from the professionals.
What language did you code in?
Murray
|
|
|
|
|