I am trying to compile a source code of vb6 name building the time tracking system. The problem is somewhere in procedure. Kindly let me know the solution. The code is
Private Sub cmdOK_Click() Dim sngBilledTime As Single, iMinutes As Integer, iHours As Integer Dim iResponse As Integer If txtAmountOfTime.Text = "0.00" Then Msgbox "Your must enter the time spent." txtAmountOfTime.SetFocus Exit Sub ElseIf txtBillingRate.Text <= 0 Then Msgbox " You must enter the Billing Rate." txtBillingRate.SetFocus Exit Sub ElseIf lblBillingName.Caption = " " Then lblBillingName.Caption = InputBox("Please enter your name:") End If iResponse = Msgbox("Do you want to perview the invoice?", vbYesNo, "Invoice") If iResponse = vbNo Then End Else Load frmInvoice With frmInvoice .lblBilledBy .Caption = frmBillingInfor.lblBillingName .lblClient .Caption = frmBillingInfo.lstClient.Text .lblDate .Caption = frmBillingInfo.mskDate.Text .lblRate.Caption = Format(frmBillingInfo.txtBillingRate.Text, "Rs ####.00") .lblWorkCategory .Caption = frmBillingInfo.cboCategory.Text If frmBillingInfo.optByHour.Value = True Then .lblHourOrJob.Caption = "an Hour" iMinutes = Val(Right(Me.textAmountOfTime.Text, 2)) iHours = Left(Me.txtAmountOfTime.Text, (InStr(1, Me.txtAmountOfTime.Text, ":") - 1)) Select Case iMinutes Case Is < 15 If iHours > 0 Then sngBilledTime = iHours Else sngBilledTime = 0.5 End If Case Is >= 15 And iMinutes <= 30 sngBilledTime = iHours + 0.5 Case Is > 15 And iMinutes <= 30 sngBilledTime = iHours + 1 End Select .lblTotalAmount.Caption = Format(frmBillingInfo.txtBillingRate.Text * sngBilledTime, "Rs####.00") .lblTotalTime.Caption = sngBilledTime Else .lblHourOrJob = "form item" .lblTotalTime = "N/A" .lblTotalAmount = Format(.lblRate.Caption, "Rs####/00") End If End With
Unload Me frmInvoice.Show End Sub
On compilation the message "invalid use of property" is coming and invoice window is not displayed.
An expert who has achieved level 3 by getting 1000 points
An expert that got 10 achievements.
An expert that got 5 achievements.
An expert whose answer got voted for 100 times.
Re: vb6 source code is not compiling.
What the heck are you compiling it with that doesn't give a line number for that error? Pay attention to the titles of messageboxes! Perhaps noting what lines you changed from the original will give a clue to narrow it down, but I expect you addressed an object with a property (object.property) in a context that can't be expected to generate or use that property as you gave it. Moreover there are spaces in object names, it seems....
- If you need clarification, ask it in the comment box above.
- Better answers use proper spelling and grammar.
- Provide details, support with references or personal experience.
Tell us some more! Your answer needs to include more details to help people.You can't post answers that contain an email address.Please enter a valid email address.The email address entered is already associated to an account.Login to postPlease use English characters only.
Tip: The max point reward for answering a question is 15.
Dim parameters As New CompilerParameters()
Dim results As CompilerResults
parameters.GenerateExecutable = True
parameters.OutputAssembly = Output
results = icc.CompileAssemblyFromSource(parameters, SourceText) The code above uses the CompilerParameters object to tell the compiler that you want to generate an executable file (as opposed to a DLL) and that you want to output the resulting assembly to disk. The call to CompileAssemblyFromSource is where your assembly gets compiled. This method takes your parameters object and the source code, which is a string. Once you compile your code you can check to see if there were any compilation errors. We use the return value from CompileAssemblyFromSource, which is a CompilerResults object. This object contains an errors collection, which contains any errors that occurred during the compile. There are other options for compiling, such as compiling from a file. You can also batch compile, which means you can compile multiple files or sources at the same time. Additional information on these classes is available on MSDN Online:
The GetObject function requires either a valid file name with a path specification, or the name of a class that is registered with the system. This error has the following cause and solution:
The name specified for file name or class in a call to the GetObject function could not be found.
Check the names and try again. Make sure the name used for the class parameter matches that registered with the system.
Here's a piece of VBScript code that performs the function:
strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colItems = objWMIService.ExecQuery( _ "SELECT * FROM Win32_NetworkAdapter",,48) For Each objItem in colItems Wscript.Echo "-----------------------------------" Wscript.Echo "Win32_NetworkAdapter instance" Wscript.Echo "-----------------------------------" Wscript.Echo "MACAddress: " & objItem.MACAddress Next
You can test this on your machine to see that it works properly. I'm no longer coding with VB6 and don't have the compiler & tools loaded on any of my machines to convert and test there. It should be a simple matter to convert this script to VB6 code.