sorry if someone has posted about this before, but i require serious help
i have desgined a roman calculator, that converts a roman numeral into an arabic number and adds them up, i have two problems however and require help.
my first problem is that i must have a function that has a value as a parameter, so how do i pass a value through the function, at the moment i have each roman numeral button calling the function up
also another problem i have is that the roman numerals must ALL be in descending order, not even IV is allowed, i am struggling to do this, i know that the code should check the numeral before and see if it is greater than or equal to, if it were smaller value, then it could bring up a message box, however i have no clue on doing this, also i have very basic programming knowledge
so could someone pls suggest a piece of code to do this, it must not have any complicated variables, as the only statements i know are select case, if , do while, for- next, mod, div, Len() and MID, so pls only use those statements
* I have uploaded my file for you to view(zip)*, as you can see it is very basic compared to the kind of variables i have seen posted in other examples of code.
i have a function but i do not understand how to pass a value in the functions parameter?
second problem is how to make sure roman numerals can only be written in DESCENDING order, this could be done by checking the value of the last roman numeral, but i am unsure how to do that
hope i have cleared the explanation up, was the file working?
I just can give you some example to pass a value to a functions parameters. You could try it out once you know the idea. I don't really understand how your programs work since you didn't put any comment in your code. For the second problem, I have no idea how to sort roman numeral. If you set each of your Roman numeral into arrays or listbox this might be posible to sort. Sorry pal, I try hard to help but solution is hard to come
VB Code:
Option Explicit
Private Sub Command1_Click()
Call sumUp(Text2, Text3) 'Pass the value from text1 and text2 into sumUp parameters
End Sub
Private Function sumUp(ByVal firstNum As Integer, ByVal secNum As Integer)
Text1 = firstNum + secNum 'The operation in the sumUp function
You know I like to learn like you pal but I'm not an expert. VB is exciting Anyway, I'll study your program. So please keep on check this thread. By the way, why you use excel rather than vb6?
Last edited by Bearnerd; Apr 22nd, 2006 at 02:37 PM.
kazoo, are you talking about the numerals having to be in alphabetical order? Like CCDIILMVX? If so, do a search on string sort - there have been quite a few string sort routines posted.
i am only a basic programmer, so i do not need vb6
Programming is one thing, learning a computer language is another.
Excel is a spreadsheet program. If you want to learn programming, and you don't want to learn it the correct way (which you evidently don't - you shouldn't be writing code before you've even learned simple sorts), at least learn it with a programming language. VBA isn't a language, it's a dialect - you'll have to unlearn a lot if you want to do any real programming after you've learned VBA.
If you want to learn programming - as opposed to learning how to make programs in Excel - get a copy of Wirth's _Algorithms + Data Structures = Programs_ and study it. If you don't know algorithms and data structures you aren't really programming.
no not in alphabetical order, in descending order of value which would be MDCLXVI
is there a way to tell if the last chracter is less than or greater than the next character it is confusing, anyway thanks for explanation about programming, i think i have found out programming is not for me, and will not continue with it in the future.
Hi Kazoo! I've studied your coding and modified just a bit to make the program running completely. But for the sorting Roman alphabet I tried many times to make the needed code but I finally gave up. Hope you like your program now. I'm still looking for the solution on how to sort the Roman alphabet. If I found the answer I'll post it to you. If you know how to apply SRISA's code above, just try maybe it will help a lot. Good Luck then
Last edited by Bearnerd; Apr 25th, 2006 at 05:52 AM.
thank you very much for the program code and trying to help, it works well, but i have already reached the next part (converting arabic to roman equivalent), however i am having just one bit of trouble with the DIV operator, when you write :
random value = mynumber div 1000
it will appear with a error msgbox saying something like expected end of statement or line, why is that happening?
thank you SRISA for your help and time you spent on the code, however its a bit too hard for my basic knowledge to understand, i would be grateful if you could help on the DIV problem.