|
|
Access doesn't support true stored procedures. Though it uses something that looks like one, your limited to a single query operation with no other code constructs.
|
|
|
|
|
I have an array of string of 80 characters each to print. I only want to print 66 lines per page. Once I have printed 66 lines I want to issue a form feed (ASCII – 12). Using the mod how will can I be able to accomplish this? I am not sure on the syntax
|
|
|
|
|
if the mod of the number of lines you've printed by 66 is 0, then you're on a page break.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
So something like:
If (Array Mod 66 = 0) 'test for every 66 line
Issue form feed (ascii-12)
End If
|
|
|
|
|
Exactly. Don't forget that will work only if you start with 1. 0 with give a result of 0, and 65 will give a result of 65. 66 will give a result of 0.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
how can i retrieve coordinates and color information about every pixel from a jpeg picture ?
|
|
|
|
|
Well, you can't, really. Because a jpeg is compressed. But once you load it, it's a bitmap in memory. In C# you can do this efficiently, but in VB.NET you need to use the GetPixel method ( I'm not sure if it's on the Bitmap class or the Graphics class, I'd guess Bitmap tho ).
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Okay Im in an Intro to Software Dev. Class and im supposed to make a simple tax program this ive done, and it works perfectly... Now im supposed to take that program and split it up into different modules...or thats what it is called in pseudo-code. Here is the code i have and its in the 6th and 7th "Private Sub" is where the variables are claiming to not be declared. I can not figure it out what so ever. Thanks in advanced
Isaac
Module Module1
Const dblSTATE_TAX As Double = 0.04
Const dblCOUNTY_TAX As Double = 0.02
Sub Main()
'Chapter 3: SalesTax Program
'Programmer: Isaac Peek
'Date: October 02, 2009
'Purpose: Revision for chapter 2 so there are modules
'
'
'
'Declaration
Dim decPurchaseAmount As Decimal = 0
Dim decTotalAmount As Decimal = 0
Dim decTAX As Decimal = 0
Dim decTotalTax As Decimal = 0
'Input
getPurchaseAmount(decPurchaseAmount)
'Process and Output
showPurchaseAmount(decPurchaseAmount)
showStateTax(dblSTATE_TAX)
showCountyTax(dblCOUNTY_TAX)
showTAX(decTAX)
showTotalAmount(decTotalAmount)
showTotalTax(decTotalTax)
showTermination()
End Sub
Private Sub getPurchaseAmount(ByRef decPurchaseAmount As Decimal) 'ByRef is input and output
Console.WriteLine("Please enter the amount of your purchase: ")
decPurchaseAmount = CDec(Console.ReadLine())
End Sub
Private Sub showPurchaseAmount(ByVal decPurchaseAmount As Decimal)
Console.WriteLine("Your Purchase amount is: " & decPurchaseAmount)
End Sub
Private Sub showStateTax(ByVal dblSTATE_TAX As Decimal)
Console.WriteLine("The State tax is: " & dblSTATE_TAX)
End Sub
Private Sub showCountyTax(ByVal dblCOUNTY_TAX As Decimal)
Console.WriteLine("The County tax is: " & dblCOUNTY_TAX)
End Sub
Private Sub showTAX(ByVal decTAX As Decimal)
decTAX = dblSTATE_TAX + dblCOUNTY_TAX
End Sub
Private Sub showTotalTax(ByVal decTotalTax As Decimal)
decTotalTax = decPurchaseAmount * decTAX
Console.WriteLine("The total tax is: " & decTotalTax)
End Sub
Private Sub showTotalAmount(ByVal decTotalAmount As Decimal)
decTotalAmount = (decPurchaseAmount * decTAX + decPurchaseAmount
Console.WriteLine("The Total Purchase amount is: " & decTotalAmount)
End Sub
Private Sub showTermination()
Console.WriteLine()
Console.WriteLine("Press the enter key to terminate the program.")
Console.Read()
End Sub
End Module
modified on Monday, October 5, 2009 2:25 PM
|
|
|
|
|
Your error messages are accurate
Sezotove wrote: Const dblSTATE_TAX As Double = 0.04
Const dblCOUNTY_TAX As Double = 0.02
These are member variables, they are visible everywhere
Sezotove wrote: Dim decPurchaseAmount As Decimal = 0
Dim decTotalAmount As Decimal = 0
Dim decTAX As Decimal = 0
Dim decTotalTax As Decimal = 0
These are local variables, they are visible within the method only, unless they are passed to other methods. Move them outside 'main' to make them member variables, so that your methods can see them.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Yeah i moved the up tot he global spot with the constants. the program will run but not correctly... Logical error maybe?
|
|
|
|
|
Well, the number of subs you have is insane. None of them are useful on their own, this should really all be done in your main method. Once you remove all the subs, it will be easier to step through in the debugger and work out the error in your logic.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Yeah i agree the amount of sub methods for this small program is ridiculous but I'm supposed to break the original program up into more methods. i have the original source if you would like to see it.
|
|
|
|
|
Sezotove wrote: Private Sub showTAX(ByVal decTAX As Decimal)
decTAX = dblSTATE_TAX + dblCOUNTY_TAX
End Sub
Even if decTax is a member, passing it in locally means you set the value of the local, not the member.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
well how can i get the decTAX to go from being local to a member? because that would be why the following subs are not calling the correct variable... but i still need the decTAX to be done in that method.
|
|
|
|
|
Don't pass it in. If you don't create a local variable with that name, then the member one will stay in scope.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Better still put all of this into a prober object orientated model, as .Net is and object orientated language.
If you had it all in a class called Product, with properties for PurchaseAmount and so on then your Main can just create a new Product object, set the purchase amount and call the methods on the Product object to display the results.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
No worries, i fixed it by making all the declared variables in the first method as globals, and did all the math calculations in a single method and had the others out put them. I dont quite know if this is what my teacher wants... but oh well its what im giving him.
|
|
|
|
|
Hello all
i am making a lap counter
and i am trying to calculate the avarage time from 5 laps
i have each lap time in a text box i tryed this and it did not work
Dim mymath as string
mymath = textbox1.text + textbox2.text + textbox3.text + textbox4.text + textbox5.text / 5
msgbox = (mymath)
but it dont work
can anyone help me
Thanks agine
Bob
|
|
|
|
|
use
mymath = (CSng(textbox1.Text) + CSng(textbox2.Text) + CSng(textbox3.Text) + CSng(textbox4.Text) + CSng(textbox5.Text))/5
I think this would work.
|
|
|
|
|
There is no such thing as averaging string together, so I'm not surprised this didn't work.
Convert each string in your textboxes to TimeSpan objects. You can then easily get the number of milliseconds in each TimeSpan, average those together and create a new TimeSpan object with the result. This will give you the ability to easily convert the result to a String you can display in the correct format.
|
|
|
|
|
Hi Dave
i looked it up and tryed a few thing but i cant get it to work
can i have a example please ???
Thanks
Bob
|
|
|
|
|
You convert a string in a TextBox to a TimeSpan using:
Dim timeIntervals(5) As TimeSpan
' 5 hours, 21 minutes, 40 seconds
TimeSpan.TryParse("5:21:40", timeIntervals(0))
You can add all of the time intervals together like this:
Dim avgTime As New TimeSpan
For i As Integer = 0 to 4
avgTime = avgTime.Add(time(i))
Next
And then average the times:
avgTime = New TimeSpan(avgTime.Ticks / 5)
|
|
|
|
|
Hello everyone
how can i make a button do one thing when click and when you click it agine it will somting else and so on
somting like this
click once = code1
click twice = code2
click three time = code3
click a forth time = code4
on and on
Thanks
Bob
|
|
|
|
|
Two ways. One is to have a class level variable that will hold the click count. Checking that, you can execute the appropriate code. Or you can use the Tag property of the button serving the same purpose. Although you will need to cast that to integer every time you use it.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|