Calculator Program In Vb
Well, in my opinion you're doing it wrong way.As to the body of function.From programming practice perspective, function should be as much universal as possible. There are few things you have missed- The function should have a return type- Instead of checking the parameter you call the Calculator function recursively in the case structureTry something like the followingPublic Function Calculator( ByVal strMod As String) As Single Dim Num1 As Integer = TextBox1.TextDim Num2 As Integer = TextBox2.TextDim Num3 As Single = TextBox3.TextSelect Case strModCase ' Add'Num3 = Num1 + Num2Case ' Sub'Num3 = Num1 - Num2End Select Return Num3End FunctionAlso note:- not sure why you assign a value to num3 from the textbox3. Should you do it the other way around if Textbox3 is for the result- Instead of passing a string for the operation I'd suggest using enumeration. See - and it would probably be more elegant if you would pass num1 and num2 as parameters to the function. This way the function wouldn't depend on the user interface objects and could be used for different kinds of objects and situations.ADDEDFor assigning the value to TextBox3Public Sub OutputClick(sender As Object, e As EventArgs) Handles Button1.ClickTextBox3.Text = Calculator( ' Sub')End SubAlso get familiar with debugging the program. For example go through. When answering a question please:.
Read the question carefully. Understand that English isn't everyone's first language so be lenient of badspelling and grammar. If a question is poorly phrased then either ask for clarification, ignore it, oredit the question and fix the problem. Insults are not welcome. Don't tell someone to read the manual. Chances are they have and don't get it.Provide an answer or move on to the next question.Let's work to help developers, not make them feel stupid.
Note: Due to the size or complexity of this submission, the author has submitted it as a.zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.FOR YOUR OWN SAFETY, PLEASE:1.
Re-scan downloaded files using your personal virus checker before using it.2. NEVER, EVER run compiled files (.exe's,.ocx's,.dll's etc.)-only run source code. Filtered HTML. Web page addresses and e-mail addresses turn into links automatically. You may insert videos with video:URL.
Calculator Program In Vb6.0
Allowed HTML tags: video. You can enable syntax highlighting of source code with the following tags:,. The supported tag styles are:, foo. Lines and paragraphs break automatically.
Memory:2 GB RAM. Splinter cell blacklist system requirements. Processor:2.53 GHz Intel® Core™2 Duo E6400 or 2.80 GHz AMD Athlon™ 64 X2 5600+ or better.