hello,
I am a very beginner programmer. In my code I have create a basic add/sub feature, three textbox and two buttons( +,-). Two o f the textboxes will accept a value, when one of the buttons(+,-) is clicked the result shows up in the third textbox and then the display button will show it in the list box. I then am trying to code a listbox where I can select an line from the listbox, have it show up in the textboxes I created and modify it and save it back to the listbox/database...
for example 1+2=3 is in listbox, when you click this line in the listbox it will show 1,3 in the textboxes and you can then click the subtract button to modify it and save results back in textbox/database.
here is the code I wrote
Public Class Form1 Dim c As New MathOp Dim d As New MathOp2 Dim Num1 As Integer Dim Num2 As Integer Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Num1 = c.add(CInt(TextBox1.Text), CInt(TextBox2.Text)) TextBox3.Text = Num1 'TextBox3.Text = c.add(CInt(TextBox1.Text), CInt(TextBox2.Text)) End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Num2 = c.subt(CInt(TextBox1.Text), CInt(TextBox2.Text)) TextBox3.Text = Num2 End Sub End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click Dim showtext As String If TextBox3.Text = Num1 Then showtext = (TextBox1.Text & "+" & TextBox2.Text & "=" & Num1) ListBox1.Items.Add(showtext) ElseIf TextBox3.Text = Num2 Then showtext = (TextBox1.Text & "-" & TextBox2.Text & "=" & Num2) ListBox1.Items.Add(showtext) End If End Sub End Class
THanks so much for any help