Math Help Needed With Public Function In Visual Basic For Applications? Need Function That Does The Opposite?
340306
Your function translates 0.340335648148148 to 8:10, but my function translates 8:10 to 0.3477777-ish.  The reason for this is because when the function above converts the time, it drops the seconds (and milliseconds, etc.).  Because of this, a level of precision is lost and the reverse function may not always yield the same value.\n\nGood luck!  E-mail me if you have any questions.\n\nThis should do it:  (You may need to tweak a bit for syntax)\n\nPublic Function HoursAndMinutesBack(interval As String) As Variant\n\nDim hours, minutes As String\n\ncolon = InStr(interval, ":")\n\nhours = Mid(interval, 1, colon - 1)\nminutes = Mid(interval, colon + 1)\n\nHoursAndMinutesBack = (hours / 24) + (minutes / 1440)\n\nEnd Function
572733
Please check out this site it gives averything you want on VBA.\n\nwww.functionx.com
799761
It works for me. But any way I think you can log on to www.allexperts.com\nGo to Computing-Programing-Basic-vb.net and post the question there.\nMany a problems for me have been rectified.\nIts free of charge.\nHope this helps.\nCMR
1165079
Create a user-defined function: (make sure to paste this in a module for the workbook, not in a sheet)\n\nFunction CountChars(Txt As String, Char As String) As Integer\n    CountChars = Len(Txt) - Len(Replace(Txt, Char, ""))\nEnd Function\n\nThen use the new function:\n=countchars(lower(A1),"a")&" "&countchars(lower(A1),"e")&" "&countchars(lower(A1),"i")&" "&countchars(lower(A1),"o")&" "&countchars(lower(A1),"u")\n\nAs written, it will return an answer of 1 2 0 0 0 for the string "statement." One "a", two "e" and 0 for the other three vowels.\n\nYou should be able to come up with a better formula to use it.
678911
Check out the site at http://www.pscode.com - I don't do C++ but I use that site all the time for Visual BASIC stuff I work on.
197427
Sub Main()\n        Console.WriteLine(2 ^ 5)\n        Console.ReadLine()\nEnd Sub
878923
Make a program on your calculator.\nView the snippet in the link for code.
299182
vc++ is much more tougher to handle than it's compatriot : visual basic. As the saying goes: "vb is fun, vc++ is shit hard work!!".\n\nok..\ni'll give u da steps to create 2 edit boxes and to get the sum : )\n\nhere we go:\n\n1) open ms vc++\n2) go to file ->new and under the projects tab, select mfcappwizard (exe) , enter name and choose location to save project\n3) now, the wizard pops up.\nStep 1 : select dialog based  (since the addition thing is fairly simple, we'll go for this)\n4) press next for step 2 and once again for step 3 (which means u r accepting the default values in those steps).\n\nFinally, u get a dialog showing the summary of the application.\n\nif u have come till here..gooood!! u have created a "skeletal application" .. and this, buddy , is the true essence of MFC programming.\n\nok.. now that u have created the skeleton application , its time i teach u how to put two text boxes and if ya click a button, the sum would be displayed in another :::\n\n\n\n\n* now, on ur left, u should see a "workspace" window. its one containing a list of files in your application.\n\n* in that, select the resources tab (tab is found at bottom of workspace window)\n\n* open the tree listing. in that u would find a "dialog" sub tree\n\n* open that. and u would find a "IDD_..." thing . double click on that, and presto, u would get a blank dialog.\n\n* now, that blank dialog would be accompanied by a toolbox if u dont see the toolbox, right click on the toolbar on top of vc++ window, choose toolbox.\n\n* if u see the toolbox, good. now, choose the edit box (text box) and draw three text boxes on the dialog. now, choose the button and draw one button on the dialog.\n\n* the text boxes would have the name IDC_EDIT1 , IDC_EDIT2 and IDC_EDIT3 and button would be IDC_BUTTON1(u can see the names by right-clickin on the component and choosing properties.)\n\n* ok, now , go to view- > class wizard (a very very very important tool in vc++)\n\n* move to "member variables" tab. u can see the components that u have added.( if u have not, just try flickering with the drop down dialogs that u see there). \n\n* now, double click on IDC_EDIT1 and another small window appears , asking u the variable name it would ve already displayed "m_" DONOT remove the "m_" jus add something to it like : "m_number1" . repeat same for the other two edit boxes and make sure u remember the variable names.\n\n* u have come till here?? awesome!! ; )\n\n* now close the class wizard window.\n* double click on tha button and.. u get a prompt something like onbuttonclick (somethin like dat) ..whatever comes, press ok. and presto, u go into the coding wonderland.\n\n* remember the varible names ?? goood. and u kno how to put an addition statement?? awesome!! . jus do that.. eg: m_number3=m_number1+m_number2;\n\n*CAUTION : while giving variable names , make sure u <<CHOOSE THE int TYPE>>\n\n* phew.. take a break and come back cos u r gonna watch ur creation come to life ; )\n\n*goto project->build xyz.exe\n\n* wait till it completes compilation and shows the sweet words "0 errors 0 warnings" on the bottom window of the screen (watch window).\n\n* press ctrl+f5 and voila.. u get ur own summing application created using MFC and with help of appwizard,classwizard and moi, ANAND ; )\n\n\n\n\nIF u have encountered any problem anywhere enroute to success, worry - not. Send me a message Y! id: anand_87123\ny! mail : anand_87123@yahoo.com\nput the subject line as vc++ - Y! answer\n\nok??\n\nP.S : if ya feel i have helped ya, i dont mind my answer being voted as the best answer by u!!\n\nand also, i can prescribe 2 books for ya :\n1) MFC programming by JEFF PROSISE and \n2) David J Kruglinski, Scott Wingo :: "Programming Microsoft Vc++ Fifth edition"\n\nthey are available for download from da net (illegal ofcourse ... ; ) ) try searching
540500
Here you go (requires VB.NET)\n\nhttp://www.codeproject.com/useritems/sudoku.asp
888701
ha! max is not a builtin function.\n\nbut Math.max is!\n\nalert( Math.max( 10,5,21,54,23) )\n\nworks!
1118192
I don't use vb.net myself (C# I use).\n\nIf you want to keep the 0's in the front though, it has to be a string, not an integer.\n\nYou convert it over to integer, add the next number, then cast it back to string, and pad the length to the desired number of 0's\n\nPseudo code:\n\nLicenseNoNum = CastToInt(LicenseNostr)\nLicenseNoNum = LicenseNoNum + 1\nLicenseNoStr = CastToStr(LicenseNoNum)\nWhile LicenseNoStr(Length) < 8\nLicenseNoStr = '0' + LicenseNoStr.\n\nYou could also just store it as an integer, and perform the cast for printing, which might be all you were looking for.
791942
First off, the program you designede in visual, are you running it in another visual basic program or are you importing it into another program.  Second, all you need to do to run the program by single key execution is to set the program to a macro.  For more detailed info go to the help section in visual (or press f1) and type in "macro".  Everything you need should be there.  You can send me a direct e-mail if you have any other issues the help won't help with (flyingrizzly@yahoo)
142557
you would need a compiler.. I assume your writing a visual basic program..\nThe easiest to do it is to use EXCEL assuming you have excel... You have to look in the macro area in tools bar. There is a visual basic editor!\n\nBut if your planning to program a program*, you can use Microsoft Visual Studio to do so... It costs money thou! GEt an educational copy (free).\n\nThe excel way is free... if you have office excel..
273902
Here are functions to go both ways from my Calculator program in VB6. You'll have to convert it into C++, but that shouldn't be too hard. E-mail me later if you can'c figure out how to convert it to C++...\n\n' sRomanStr = GetDecRomanStr( 234 )\nPublic Function GetDecRomanStr(ByVal xDecimal As Double) As String\n    Dim iThousands, iHundreds, iTens, iOnes As Integer\n    Dim sReturnStr As String\n    Dim sHunds(9) As String\n    Dim sTens(9) As String\n    Dim sOnes(9) As String\n    \n    sHunds(1) = "C"\n    sHunds(2) = "CC"\n    sHunds(3) = "CCC"\n    sHunds(4) = "CD"\n    sHunds(5) = "D"\n    sHunds(6) = "DC"\n    sHunds(7) = "DCC"\n    sHunds(8) = "DCCC"\n    sHunds(9) = "CM"\n    sTens(1) = "X"\n    sTens(2) = "XX"\n    sTens(3) = "XXX"\n    sTens(4) = "XL"\n    sTens(5) = "L"\n    sTens(6) = "LX"\n    sTens(7) = "LXX"\n    sTens(8) = "LXXX"\n    sTens(9) = "XC"\n    sOnes(1) = "I"\n    sOnes(2) = "II"\n    sOnes(3) = "III"\n    sOnes(4) = "IV"\n    sOnes(5) = "V"\n    sOnes(6) = "VI"\n    sOnes(7) = "VII"\n    sOnes(8) = "VIII"\n    sOnes(9) = "IX"\n    \n    iThousands = (xDecimal - (xDecimal Mod 1000)) / 1000\n    xDecimal = xDecimal Mod 1000\n    iHundreds = (xDecimal - (xDecimal Mod 100)) / 100\n    xDecimal = xDecimal Mod 100\n    iTens = (xDecimal - (xDecimal Mod 10)) / 10\n    xDecimal = xDecimal Mod 10\n    iOnes = xDecimal\n    \n    sReturnStr = ""\n    For iCount = 1 To iThousands\n        sReturnStr = sReturnStr + "M"\n    Next\n    If iHundreds > 0 Then\n        sReturnStr = sReturnStr + sHunds(iHundreds)\n    End If\n    If iTens > 0 Then\n        sReturnStr = sReturnStr + sTens(iTens)\n    End If\n    If iOnes > 0 Then\n        sReturnStr = sReturnStr + sOnes(iOnes)\n    End If\n    GetDecRomanStr = sReturnStr\nEnd Function\n\n' xDecimal = GetRomanDecNum( sRomanStr )\nPublic Function GetRomanDecNum(ByVal sRomanStr As String) As Double\n    Dim xDecimal As Double\n    Dim sStr As String\n        \n    sStr = Left(sRomanStr, 1)\n    While sStr = "M"\n        xDecimal = xDecimal + 1000\n        sRomanStr = Right(sRomanStr, Len(sRomanStr) - 1)\n        sStr = Left(sRomanStr, 1)\n    Wend\n    \n    iHunds = 0\n    If Left(sRomanStr, 2) = "CM" Then\n        iHunds = 9\n        sRomanStr = Right(sRomanStr, Len(sRomanStr) - 2)\n    Else\n        If Left(sRomanStr, 1) = "D" Then\n            iHunds = 5\n            sRomanStr = Right(sRomanStr, Len(sRomanStr) - 1)\n        Else\n            If Left(sRomanStr, 2) = "CD" Then\n                iHunds = 4\n                sRomanStr = Right(sRomanStr, Len(sRomanStr) - 2)\n            End If\n        End If\n    End If\n    If iHunds = 0 Or iHunds = 5 Then\n        sStr = Left(sRomanStr, 1)\n        While sStr = "C"\n            iHunds = iHunds + 1\n            sRomanStr = Right(sRomanStr, Len(sRomanStr) - 1)\n            sStr = Left(sRomanStr, 1)\n        Wend\n    End If\n    xDecimal = xDecimal + iHunds * 100\n    \n    iTens = 0\n    If Left(sRomanStr, 2) = "XC" Then\n        iTens = 9\n        sRomanStr = Right(sRomanStr, Len(sRomanStr) - 2)\n    Else\n        If Left(sRomanStr, 1) = "L" Then\n            iTens = 5\n            sRomanStr = Right(sRomanStr, Len(sRomanStr) - 1)\n        Else\n            If Left(sRomanStr, 2) = "XL" Then\n                iTens = 4\n                sRomanStr = Right(sRomanStr, Len(sRomanStr) - 2)\n            End If\n        End If\n    End If\n    If iTens = 0 Or iTens = 5 Then\n        sStr = Left(sRomanStr, 1)\n        While sStr = "X"\n            iTens = iTens + 1\n            sRomanStr = Right(sRomanStr, Len(sRomanStr) - 1)\n
1123125
Function CountWords(strText As String) As Long\n   ' This procedure counts the number of words in a string.\n\n   Dim astrWords() As String\n\n   astrWords = Split(strText)\n   ' Count number of elements in array -- this will be the\n   ' number of words.\n   CountWords = UBound(astrWords) - LBound(astrWords) + 1\nEnd Function\n\nYou can modify above function to split using pipe delimiter.
762970
If by passing variables you mean passing them and not using them? please clarify your question...but if so\n\nThere are two general ways to pass a variable...\n\nIn Visual Basic speak they are By Value and By Reference\nIn C speak there is passing a variable and passing a pointer to a variable\n\nUsing VB:By Value or C: Passing:\n+/-) The function will not be able to edit the variable you give it\n-) A copy of the variable must be created this takes more ram and calls to allocate the space etc... slower but not really noticeable\n\nUsing VB:By Reference or C: Pointers:\n+/-) The function can edit the variable you pass\n+) No copy is made and the memory address of your variable is passed to the function\n\nWhen you pass 'By Value' you are giving the function a copy of the variable so if have the following VB code:\n\n...\n    sName = "Bob"\n    bResult = CheckMyName(sName)\n    MsgBox sName\n....\nPublic Function CheckMyName(ByVal sPName) As Boolean\n    sPName = "David"\nEnd Function\n\nNow yes im using plain old VB code here... but your question wasn't exactly full of information to help with answering it :)\n\nThat code will simply show a message box with "Bob" as it passes the sName variable by value so it makes a copy... now if change the function just a little...\n\n...\n    sName = "Bob"\n    bResult = CheckMyName(sName)\n    MsgBox sName\n....\nPublic Function CheckMyName(ByRef sPName) As Boolean\n    sPName = "David"\nEnd Function\n\nThis code will show a messagebox of "David" as we passed the variable by reference\n\nhope you get what i mean... if not, ask and i can clarify
551354
It's a bit tricky, but the function you want to call is the Interaction.Command function  This exists in both VB6 and VB.NET, although the .NET version is enhanced to a be a bit more powerful.  \n\nWhen you call the interaction.command function, it returns a variant data type containing everything in the line after the program name.  So, if you had typed something like:\n\nmyExecutable.exe /a=myName /b=myHeight\n\nyou would do the following:\n\ndim strCommand as string\nstrCommand=interaction.command\n\nThe value in strCommand at this point would be:  \n\n/a=myName /b=myHeight\n\nYou have to parse through the return to find whatever separator characters you defined, count arguements, etc. The best way I've found to do this in VB6 is with a loop from 1 to the len(strCommand).  Test each character looking for your separator charactors, and then you just use the MID function to extract thos parts to wherever you need to put them.