mattijsstu
Member
- Joined
- Feb 19, 2013
- Messages
- 15
- Programming Experience
- Beginner
hi, i have a problem in my program (code below). When i select a cell in my datagrid, it's value displays in the textbox2. this works however sometimes it does not change when i select another cell. Can some one help me please?
thanks
EDIT: feel so stupid changed cellcontentclick to cellclick.....
still i would like to make all my results# moved to a database i made, can any one give me links to info about these kind of things ?
VB.NET:
Imports System.IOPublic Class Form1
Dim result1 As Double
Dim result2 As Double
Dim result3 As Double
Dim result4 As Double
Dim result5 As Double
Dim result6 As Double
Dim result7 As Double
Dim resultfromtextbox1 As Double
Dim resultfromtextbox2 As Double
Dim resultfromtextbox6 As Double
Dim resultfromtextbox7 As Double
Dim resultfromtextbox8 As Double
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Database_q_waardeDataSet.q_waarden_tbl' table. You can move, or remove it, as needed.
Me.Q_waarden_tblTableAdapter.Fill(Me.Database_q_waardeDataSet.q_waarden_tbl)
End Sub
Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
TextBox2.Text = DataGridView1.CurrentCell.Value
End Sub
Private Sub btnCalculate_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
Double.TryParse(TextBox1.Text, resultfromtextbox1)
Double.TryParse(TextBox2.Text, resultfromtextbox2)
Double.TryParse(TextBox6.Text, resultfromtextbox6)
Double.TryParse(TextBox7.Text, resultfromtextbox7)
Double.TryParse(TextBox8.Text, resultfromtextbox8)
result1 = 2.718281828 ^ ((3 / 7) * (Math.Log(resultfromtextbox1) - Math.Log(57.7) - Math.Log(resultfromtextbox2)))
result2 = 50 / (result1 ^ (2 / 3))
result3 = 0.5357 * result1
result6 = result3 + result1
result4 = (result6 / 2) * (Math.Cos((resultfromtextbox7 * Math.PI) / 180))
result5 = result4 + resultfromtextbox6
result7 = result1 * resultfromtextbox8
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
thanks
EDIT: feel so stupid changed cellcontentclick to cellclick.....
still i would like to make all my results# moved to a database i made, can any one give me links to info about these kind of things ?