473,396 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

convert codes....

hallo...can i get some knowladge...about java script convert to V.B....how??like 'calculation downloadable',i've get a formula calculate but in java script....how i want convert this language to V.B

This is formula in java script:

<script language="JavaScript">
<!--
var gaji;
var cpekerja;
var cmajikan;
var semua;
var pilih;

function kira(form) {
pilih = form.pilihan.options[form.pilihan.selectedIndex].value;
gaji = form.gaji.value;

if (pilih == '' || gaji == '' || gaji == '0' || gaji == '0.00' || gaji == '0.0') {
alert('Please select year and your annual income for that year.'); } else { if (pilih == '1') {
cpekerja=5;
cmajikan=5;
form.cpekerja.value=cpekerja;
form.cmajikan.value=cmajikan;
} else if (pilih == '3') {
cpekerja=6;
cmajikan=7;
form.cpekerja.value=cpekerja;
form.cmajikan.value=cmajikan;
} else if (pilih == '4') {
cpekerja=9;
cmajikan=11;
form.cpekerja.value=cpekerja;
form.cmajikan.value=cmajikan;
} else if (pilih == '5') {
cpekerja=10;
cmajikan=12;
form.cpekerja.value=cpekerja;
form.cmajikan.value=cmajikan;
} else if (pilih=='6') {
cpekerja=11;
cmajikan=12;
form.cpekerja.value=cpekerja;
form.cmajikan.value=cmajikan;
} if (pilih=='7') {
cpekerja=9;
cmajikan=12;
form.cpekerja.value=cpekerja;
form.cmajikan.value=cmajikan;
}
cpekerja = (cpekerja*gaji)/100;
form.total.value = cpekerja

cmajikan = (cmajikan*gaji)/100;
form.total.value = cmajikan

cpekerja = eval(cpekerja);
cmajikan = eval(cmajikan);
semua = cpekerja + cmajikan;
form.total.value=Math.round(semua*100)/100;
}
}

//-->
</script>
Nov 28 '06 #1
4 1924
Killer42
8,435 Expert 8TB
Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript">
  2.     <!--
  3.     var gaji;
  4.     var cpekerja;
  5.     var cmajikan;
  6.     var semua;
  7.     var pilih;
  8.  
  9.     function kira(form) {
  10.         pilih = form.pilihan.options[form.pilihan.selectedIndex].value;
  11.         gaji = form.gaji.value;
  12.  
  13.         if (pilih == '' || gaji == '' || gaji == '0' || gaji == '0.00' || gaji == '0.0') {
  14.             alert('Please select year and your annual income for that year.'); } else { if (pilih == '1') {
  15.                 cpekerja=5;
  16.                 cmajikan=5;
  17.                 form.cpekerja.value=cpekerja;
  18.                 form.cmajikan.value=cmajikan;
  19.             } else if (pilih == '3') {
  20.                 cpekerja=6;
  21.                 cmajikan=7;
  22.                 form.cpekerja.value=cpekerja;
  23.                 form.cmajikan.value=cmajikan;
  24.             } else if (pilih == '4') {
  25.                 cpekerja=9;
  26.                 cmajikan=11;
  27.                 form.cpekerja.value=cpekerja;
  28.                 form.cmajikan.value=cmajikan;
  29.             } else if (pilih == '5') {
  30.                 cpekerja=10;
  31.                 cmajikan=12;
  32.                 form.cpekerja.value=cpekerja;
  33.                 form.cmajikan.value=cmajikan;
  34.             } else if (pilih=='6') {
  35.                 cpekerja=11;
  36.                 cmajikan=12;
  37.                 form.cpekerja.value=cpekerja;
  38.                 form.cmajikan.value=cmajikan;
  39.             } if (pilih=='7') {
  40.                 cpekerja=9;
  41.                 cmajikan=12;
  42.                 form.cpekerja.value=cpekerja;
  43.                 form.cmajikan.value=cmajikan;
  44.             }
  45.             cpekerja = (cpekerja*gaji)/100;
  46.             form.total.value = cpekerja
  47.  
  48.             cmajikan = (cmajikan*gaji)/100;
  49.             form.total.value = cmajikan
  50.  
  51.             cpekerja = eval(cpekerja);
  52.             cmajikan = eval(cmajikan);
  53.             semua = cpekerja + cmajikan;
  54.             form.total.value=Math.round(semua*100)/100;
  55.         }
  56.     }
  57.  
  58.     //-->
  59.     </script>
First, a question. I realise that I'm dealing with a somewhat unfamiliar language. But surely setting the same variable (or control) three times (as highlighted above) would not serve much purpose? And what is the significance of the missing semicolons on these lines?

Anyway, here's my first draft...
Expand|Select|Wrap|Line Numbers
  1. Public Sub kira(frm As Form)
  2.  
  3.   Dim gaji, cpekerja, cmajikan, semua, pilih
  4.  
  5.  
  6. ' Sorry, I don't know how to translate this line...
  7. '  pilih = frm.pilihan.options[form.pilihan.selectedIndex].value;
  8.  
  9. ' This depends on the type of control. If it's a textbox for example, you'd want .Text rather than .value
  10.    gaji = frm.gaji.value
  11.  
  12.   If pilih = "" or gaji = "" or gaji = "0" or gaji = "0.00' or gaji = "0.0" Then
  13.     MessageBox "Please select year and your annual income for that year."
  14.     Exit Sub
  15.   End If
  16.  
  17.   Select case pilih
  18.     Case "1"
  19.      cpekerja = 5
  20.      cmajikan = 5
  21.      frm.cpekerja = cpekerja
  22.      frm.cmajikan = cmajikan
  23. ' How come there's no 2?
  24.     Case "3"
  25.      cpekerja = 6
  26.      cmajikan = 7
  27.      frm.cpekerja = cpekerja
  28.      frm.cmajikan = cmajikan
  29.     Case "4"
  30.      cpekerja = 9
  31.      cmajikan = 11
  32.      frm.cpekerja = cpekerja
  33.      frm.cmajikan = cmajikan
  34.     Case "5"
  35.      cpekerja = 10
  36.      cmajikan = 12
  37.      frm.cpekerja = cpekerja
  38.      frm.cmajikan = cmajikan
  39.     Case "6"
  40.      cpekerja = 11
  41.      cmajikan = 12
  42.      frm.cpekerja = cpekerja
  43.      frm.cmajikan = cmajikan
  44.     Case "7"
  45.      cpekerja = 9
  46.      cmajikan = 12
  47.      frm.cpekerja = cpekerja
  48.      frm.cmajikan = cmajikan
  49.   End Select
  50.  
  51.  
  52.   cpekerja = (cpekerja*gaji)/100;
  53.   frm.total = cpekerja
  54.  
  55.   cmajikan = (cmajikan*gaji)/100;
  56.   frm.total = cmajikan
  57.  
  58. '  cpekerja = eval(cpekerja);   What does this do?
  59. '  cmajikan = eval(cmajikan);   What does this do?
  60.   semua = cpekerja + cmajikan;
  61.   frm.total=(semua*100)/100
  62. End Sub
Nov 28 '06 #2
sashi
1,754 Expert 1GB
First, a question. I realise that I'm dealing with a somewhat unfamiliar language. But surely setting the same variable (or control) three times (as highlighted above) would not serve much purpose? And what is the significance of the missing semicolons on these lines?

Anyway, here's my first draft...
Expand|Select|Wrap|Line Numbers
  1. Public Sub kira(frm As Form)
  2.  
  3.   Dim gaji, cpekerja, cmajikan, semua, pilih
  4.  
  5.  
  6. ' Sorry, I don't know how to translate this line...
  7. '  pilih = frm.pilihan.options[form.pilihan.selectedIndex].value;
  8.  
  9. ' This depends on the type of control. If it's a textbox for example, you'd want .Text rather than .value
  10.    gaji = frm.gaji.value
  11.  
  12.   If pilih = "" or gaji = "" or gaji = "0" or gaji = "0.00' or gaji = "0.0" Then
  13.     MessageBox "Please select year and your annual income for that year."
  14.     Exit Sub
  15.   End If
  16.  
  17.   Select case pilih
  18.     Case "1"
  19.      cpekerja = 5
  20.      cmajikan = 5
  21.      frm.cpekerja = cpekerja
  22.      frm.cmajikan = cmajikan
  23. ' How come there's no 2?
  24.     Case "3"
  25.      cpekerja = 6
  26.      cmajikan = 7
  27.      frm.cpekerja = cpekerja
  28.      frm.cmajikan = cmajikan
  29.     Case "4"
  30.      cpekerja = 9
  31.      cmajikan = 11
  32.      frm.cpekerja = cpekerja
  33.      frm.cmajikan = cmajikan
  34.     Case "5"
  35.      cpekerja = 10
  36.      cmajikan = 12
  37.      frm.cpekerja = cpekerja
  38.      frm.cmajikan = cmajikan
  39.     Case "6"
  40.      cpekerja = 11
  41.      cmajikan = 12
  42.      frm.cpekerja = cpekerja
  43.      frm.cmajikan = cmajikan
  44.     Case "7"
  45.      cpekerja = 9
  46.      cmajikan = 12
  47.      frm.cpekerja = cpekerja
  48.      frm.cmajikan = cmajikan
  49.   End Select
  50.  
  51.  
  52.   cpekerja = (cpekerja*gaji)/100;
  53.   frm.total = cpekerja
  54.  
  55.   cmajikan = (cmajikan*gaji)/100;
  56.   frm.total = cmajikan
  57.  
  58. '  cpekerja = eval(cpekerja);   What does this do?
  59. '  cmajikan = eval(cmajikan);   What does this do?
  60.   semua = cpekerja + cmajikan;
  61.   frm.total=(semua*100)/100
  62. End Sub
Hi Killer,

It's Bahasa Melayu (Malay Language), i think he is a Malaysian. :)
Nov 28 '06 #3
Killer42
8,435 Expert 8TB
It's Bahasa Melayu (Malay Language), i think he is a Malaysian. :)
Thanks sashi. But I was referring to the javascript.
Nov 28 '06 #4
Killer42
8,435 Expert 8TB
...
Expand|Select|Wrap|Line Numbers
  1. ...
  2.   cpekerja = (cpekerja*gaji)/100;
  3. ...
  4.   cmajikan = (cmajikan*gaji)/100;
  5.  
Sorry, I forgot to remove the semicolons from these two lines. VB probably won't like them.
Nov 28 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Lamberti Fabrizio | last post by:
Hi all. I've got an ActiveX Object that gives me OleColor codes for its graphical components. I need to convert these OleColor codes into RGB codes using JScript or VBScript, becuase I have...
1
by: rob.kellington at gmail | last post by:
Does anyone have the logic to convert RTF formatted data in a text column into plain ascii text that I can use in a varchar variable or field? We have an app that allows formatted comments/notes...
11
by: Kai Bohli | last post by:
Hi all ! I need to translate a string to Ascii and return a string again. The code below dosen't work for Ascii (Superset) codes above 127. Any help are greatly appreciated. protected...
2
by: ABC | last post by:
I have a very large amount VB code convert into C Sharp. I just complete it use tools. But it still have some codes errors. There are object to datatype problems. I need to edit many files to...
25
by: Charles Law | last post by:
I thought this was going to be straight forward, given the wealth of conversion functions in .NET, but it is proving more convoluted than imagined. Given the following <code> Dim ba(1) As...
3
by: Jonathan | last post by:
Hi I want to convert HTML codes ("!" , "#" , "$" , "%") to text ("!","#", "$", "%"). How can i do it without replacing one an one the codes? Thanks in advance
0
by: prabhuvonnet | last post by:
Hello all, I need to convert this following vb.net codes to c# codes within a day or two. So i need this help urgently. Please look at the following code and help me out to finish this barcode...
0
by: setheo | last post by:
To all gurus, I am currently converting some of C++ codes to VB.net The C++ Codes is as follows : ================= C++ CODE ================== typedef struct _tagBBCameraParameter {...
2
by: Poppy | last post by:
I'm reading from a database a column that has a list of codes (comma seperated). When I read in the list I have a single value, see code sample below values for a, b, and c. These represent...
4
by: Peter | last post by:
Does anyone know how to convert the following VB6 code to C# code? Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As Any, Source As Any, ByVal bytes As Long) Dim...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.