Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Let a user pick one variable out of a table

$
0
0
Hi

This is my code:
Imports System.IO

Public Class Form1
    Dim result1 As String = ""
    Dim result2 As String = ""
    Dim result3 As String = ""
    Dim result4 As String = ""
    Dim result5 As String = ""
    Dim result6 As String = ""
    Dim result7 As String = ""
    Private Sub btnCalculate_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        result1 = 2.718281828 ^ ((3 / 7) * (Math.Log(Val(TextBox1.Text)) - Math.Log(57.7) - Math.Log(Val(TextBox2.Text))))
        result2 = 50 / (result1 ^ (2 / 3))
        result3 = 0.5 * (result1)
        result6 = result3 + result1
        result4 = (result6 * (Math.Cos(Val(TextBox7.Text)).ToString)) / 2
        result5 = result4 + Val(TextBox6.Text).ToString
        result7 = result1 * Val(TextBox8.Text)
        TextBox3.Text = result1
        TextBox4.Text = result2
        TextBox5.Text = result3

    End Sub

    Private Sub btnSave_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim saveFileDialog1 As New SaveFileDialog()

        saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
        saveFileDialog1.FilterIndex = 2
        saveFileDialog1.RestoreDirectory = True

        If saveFileDialog1.ShowDialog() = DialogResult.OK Then
            'open a new file stream with your selected filename from the SaveDialog control
            Using myStream As New StreamWriter(saveFileDialog1.FileName)
                myStream.WriteLine("D=" & result1)
                myStream.WriteLine("n_max=" & result2)
                myStream.WriteLine("d=" & result3)
                myStream.WriteLine("hv=" & result4)
                myStream.WriteLine("V=" & result5)
                myStream.WriteLine("ht=" & result7)

                myStream.Close()
            End Using
            MsgBox("Created File " & saveFileDialog1.FileName)
        End If
    End Sub

End Class


I would like to be able to let a user of my program pick 2 variables out of a table, the one he picks out of table one goes to the value of textbox2 and another value he picks out of a second table goes to textbox8. So when the programs runs the user gets 3 textboxes he needs to fill in and 2 tables to pick a variable out of, when he then pushes button2, it calculates.

Buth for now i still get an error with this basic program i included 2 screenshots of the error message and the values i fill in:
error message :
let me translate a bit:the conversion of string 2,144285745211874,28857149042375 to double is unvalid
Posted Image
this i fill in to my program, after clicking calculat(button2) i get the error above
Posted Image

Ty i hope i gave anough info

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>