Imports System.Math
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim kisauzun As Double
Call dogrula()
TextBox1.Text = kuvvet
TextBox2.Text = u
TextBox3.Text = h
TextBox4.Text = g
TextBox5.Text = boy
If RadioButton1.Checked = True Then
Module1.e = 207000
Module1.sigma = 180
End If
If RadioButton2.Checked = True Then
Module1.e = 105000
Module1.sigma = 275
End If
If RadioButton3.Checked = True Then
Module1.e = 69000
Module1.sigma = 35
End If
If RadioButton4.Checked = True Then
Module1.e = 97000
Module1.sigma = 75
End If
If RadioButton5.Checked = True Then
Module1.e = 97000
Module1.sigma = 69
End If
If RadioButton6.Checked = True Then
Module1.e = 45000
Module1.sigma = 175
End If
'TODO: Bu if bloklarında fonksiyonlara gönderilen değerler formüle göre değiştirilecek
If ComboBox2.Text = "U Profil" Then
Call ataletU(1, 2, 3)
End If
If ComboBox2.Text = "I Profil" Then
Call ataletI(1, 2, 3, 4, 5, 6, 7, 8)
End If
If ComboBox2.Text = "L Profil" Then
Call ataletL(1, 2)
End If
If ComboBox2.Text = "T Profil" Then
Call ataletT(1, 2, 3, 4, 5, 6)
End If
Module1.rj = Sqrt(atalet / alan)
kisauzun = Sqrt((2 * Module1.k * 3.14 ^ 2 * Module1.e) / (Module1.sigma))
If boy / rj > kisauzun Then
TextBox7.Text = "KISA ÇUBUK"
Module1.flambaj = Module1.sigma * Module1.alan * (1 - (Module1.sigma * kisauzun ^ 2 / 4 * Module1.k * PI ^ 2 * Module1.e))
End If
If boy / rj < kisauzun Then
TextBox7.Text = "UZUN ÇUBUK"
Module1.flambaj = Module1.k * PI ^ 2 * Module1.e * Module1.atalet / Module1.boy ^ 2
End If
'TODO: Emniyet katsayısı TextBox içerisine yazdırılacak.
TextBox8.Text = "FLAMBAJA UĞRAR" 'TODO: Flambaja uğrama durumu için if else bloğu eklenecek (If Flambaj > ? )
End Sub
Function ataletI(ByVal b1 As Integer, ByVal h1 As Integer, ByVal b2 As Integer, ByVal h2 As Integer, ByVal A1 As Integer, ByVal d1 As Integer, ByVal A2 As Integer, ByVal d2 As Integer)
Module1.atalet = (u * g ^ 3 - u * g ^ 3) / 12 + (g * u) * d1 ^ 2 + (g * u) * d2 ^ 2 + (g * h)
Module1.alan = (2 * g * u) + (g * h)
End Function
Function ataletU(ByVal b As Integer, ByVal h As Integer, ByVal t As Integer)
Module1.atalet = (b * h ^ 3 - (b - 2 * t) * (h - 2 * t) ^ 3) / 12
Module1.alan = (2 * g * u) + (g * h)
End Function
Function ataletT(ByVal b1 As Integer, ByVal h1 As Integer, ByVal b2 As Integer, ByVal h2 As Integer, ByVal A1 As Integer, ByVal d1 As Integer)
Module1.atalet = (b1 * h1 ^ 3 - b2 * h2 ^ 3) / 12 + A1 * d1 ^ 2
Module1.alan = (2 * g * u) + (g * h)
End Function
Function ataletL(ByVal b As Integer, ByVal h As Integer)
Module1.atalet = b * h ^ 3 / 3
Module1.alan = (2 * b * u) + (2 * h)
End Function
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
PictureBox1.Visible = True
If ComboBox1.Text = "İki ucu mafsal" Then
PictureBox1.Image = Image.FromFile("C:\Flambaj\1.jpg")
Module1.k = 1
End If
If ComboBox1.Text = "Bir ucu ankastre bir ucu serbest" Then
PictureBox1.Image = Image.FromFile("C:\Flambaj\4.jpg")
Module1.k = 0.25
End If
If ComboBox1.Text = "Bir ucu ankastre bir ucu mafsal" Then
PictureBox1.Image = Image.FromFile("C:\Flambaj\3.jpg")
Module1.k = 1.5
End If
If ComboBox1.Text = "İki ucu ankastre" Then
PictureBox1.Image = Image.FromFile("C:\Flambaj\2.jpg")
Module1.k = 2
End If
If ComboBox1.Text = "" Then
PictureBox1.Visible = False
End If
End Sub
Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
PictureBox2.Visible = True
If ComboBox2.Text = "I Profil" Then
PictureBox2.Image = Image.FromFile("C:\Flambaj\5.jpg")
Module1.k = 1
End If
If ComboBox2.Text = "T Profil" Then
PictureBox2.Image = Image.FromFile("C:\Flambaj\6.jpg")
Module1.k = 0.25
End If
If ComboBox2.Text = "U Profil" Then
PictureBox2.Image = Image.FromFile("C:\Flambaj\7.jpg")
Module1.k = 1.5
End If
If ComboBox2.Text = "L Profil" Then
PictureBox2.Image = Image.FromFile("C:\Flambaj\8.jpg")
Module1.k = 2
End If
If ComboBox2.Text = "" Then
PictureBox2.Visible = False
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PictureBox1.Visible = False
PictureBox2.Visible = False
ComboBox1.Items.Add("İki ucu mafsal")
ComboBox1.Items.Add("Bir ucu ankastre bir ucu serbest")
ComboBox1.Items.Add("Bir ucu ankastre bir ucu mafsal")
ComboBox1.Items.Add("İki ucu ankastre")
ComboBox2.Items.Add("I Profil")
ComboBox2.Items.Add("T Profil")
ComboBox2.Items.Add("U Profil")
ComboBox2.Items.Add("L Profil")
End Sub
Private Sub dogrula()
Dim dogrulaString = Space(33) + "HATA!"
If ComboBox1.Text = "" Or ComboBox2.Text = "" Then
dogrulaString = dogrulaString + vbNewLine + Space(15) + "Bağlantı şekli ve profil seçiniz..."
End If
If TextBox1.Text = "" Or TextBox1.Text = "0" Or
TextBox2.Text = "" Or TextBox2.Text = "0" Or
TextBox3.Text = "" Or TextBox3.Text = "0" Or
TextBox3.Text = "" Or TextBox4.Text = "0" Or
TextBox5.Text = "" Or TextBox5.Text = "0" Then
dogrulaString = dogrulaString + vbNewLine + Space(15) + "Hesaplama için değerleri eksiksiz giriniz..."
End If
If RadioButton1.Checked = False And RadioButton2.Checked = False And
RadioButton3.Checked = False And RadioButton4.Checked = False And
RadioButton5.Checked = False And RadioButton6.Checked = False Then
dogrulaString = dogrulaString + vbNewLine + Space(15) + "Materyal tipi seçiniz..."
End If
If dogrulaString <> Space(33) + "HATA!" Then
MsgBox(dogrulaString)
End If
End Sub
End Class