Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

simple calculator source code in winforms

i_kayash_ii_kayash_i Posts: 2Member
new in vb.net/winforms ... really new i mean...have a class project to make a simple calculator using winforms . to b honest i really dont know anything.. so plz any of u guyz help me with the code.
Tx in advance!

Comments

  • i_kayash_ii_kayash_i Posts: 2Member
    : new in vb.net/winforms ... really new i mean...have a class project to make a simple calculator using winforms . to b honest i really dont know anything.. so plz any of u guyz help me with the code.
    : Tx in advance!
    :

    i am new here..Y wont any1 help me ? ..i really needed help that is y is joined this messageboard. any help wud really be appreciated. Tx
  • Silva_DrakeSilva_Drake Posts: 9Member
    Its quite [size=1]damn[/size] simple:


    [code]Public Class Form1
    Inherits System.Windows.Forms.Form

    #Region " Windows Form Designer generated code "

    Public Sub New()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()

    'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    If disposing Then
    If Not (components Is Nothing) Then
    components.Dispose()
    End If
    End If
    MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents Button3 As System.Windows.Forms.Button
    Friend WithEvents Button4 As System.Windows.Forms.Button
    Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Private Sub InitializeComponent()
    Me.TextBox1 = New System.Windows.Forms.TextBox()
    Me.Button1 = New System.Windows.Forms.Button()
    Me.Button2 = New System.Windows.Forms.Button()
    Me.Button3 = New System.Windows.Forms.Button()
    Me.Button4 = New System.Windows.Forms.Button()
    Me.TextBox2 = New System.Windows.Forms.TextBox()
    Me.Label1 = New System.Windows.Forms.Label()
    Me.SuspendLayout()
    '
    'TextBox1
    '
    Me.TextBox1.Location = New System.Drawing.Point(8, 8)
    Me.TextBox1.Name = "TextBox1"
    Me.TextBox1.Size = New System.Drawing.Size(192, 20)
    Me.TextBox1.TabIndex = 0
    Me.TextBox1.Text = ""
    '
    'Button1
    '
    Me.Button1.Location = New System.Drawing.Point(8, 64)
    Me.Button1.Name = "Button1"
    Me.Button1.Size = New System.Drawing.Size(32, 24)
    Me.Button1.TabIndex = 1
    Me.Button1.Text = "+"
    '
    'Button2
    '
    Me.Button2.Location = New System.Drawing.Point(40, 64)
    Me.Button2.Name = "Button2"
    Me.Button2.Size = New System.Drawing.Size(32, 24)
    Me.Button2.TabIndex = 1
    Me.Button2.Text = "-"
    '
    'Button3
    '
    Me.Button3.Location = New System.Drawing.Point(72, 64)
    Me.Button3.Name = "Button3"
    Me.Button3.Size = New System.Drawing.Size(32, 24)
    Me.Button3.TabIndex = 1
    Me.Button3.Text = "*"
    '
    'Button4
    '
    Me.Button4.Location = New System.Drawing.Point(104, 64)
    Me.Button4.Name = "Button4"
    Me.Button4.Size = New System.Drawing.Size(32, 24)
    Me.Button4.TabIndex = 1
    Me.Button4.Text = "/"
    '
    'TextBox2
    '
    Me.TextBox2.Location = New System.Drawing.Point(8, 40)
    Me.TextBox2.Name = "TextBox2"
    Me.TextBox2.Size = New System.Drawing.Size(192, 20)
    Me.TextBox2.TabIndex = 0
    Me.TextBox2.Text = ""
    '
    'Label1
    '
    Me.Label1.Location = New System.Drawing.Point(8, 96)
    Me.Label1.Name = "Label1"
    Me.Label1.Size = New System.Drawing.Size(192, 24)
    Me.Label1.TabIndex = 3
    '
    'Form1
    '
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(208, 126)
    Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label1, Me.Button1, Me.TextBox1, Me.Button2, Me.Button3, Me.Button4, Me.TextBox2})
    Me.Name = "Form1"
    Me.Text = "Simple Calculator"
    Me.ResumeLayout(False)

    End Sub

    #End Region


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    On Error Resume Next
    Label1.Text = TextBox1.Text * 2 / 2 + TextBox2.Text
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    On Error Resume Next
    Label1.Text = TextBox1.Text - TextBox2.Text
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    On Error Resume Next
    Label1.Text = TextBox1.Text * TextBox2.Text
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    On Error Resume Next
    Label1.Text = TextBox1.Text / TextBox2.Text
    End Sub
    End Class
    [/code]

    ( i made this in 5 mins ;))
  • robertd33robertd33 Posts: 15Member
    1st, u mite want 2 ax the Q in english.
    2nd, u shud lern 2 do yer own hw.



    : : new in vb.net/winforms ... really new i mean...have a class project to make a simple calculator using winforms . to b honest i really dont know anything.. so plz any of u guyz help me with the code.
    : : Tx in advance!
    : :
    :
    : i am new here..Y wont any1 help me ? ..i really needed help that is y is joined this messageboard. any help wud really be appreciated. Tx
    :

Sign In or Register to comment.