Tämmönen joka kertoo monta kilobittiä on kilotavu ja päinvastoin. HUOM! Mun eka kunnon vb.net ohjelma! Älkää heti haukkuko, että "tämän voi tehdä helpommallakin tavalla" jne, kiitoos
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. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(632, 334) Me.Name = "Form1" Me.Text = "Form1" End Sub #End Region Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Hide() Dim valinta As String valinta = InputBox("Kilobitit Kilotavuiksi vai päinvastoin? & 1 = kb -> kt, 2 -> kt -> kb", "kb2kt") If valinta = "1" Then kb2kt() If valinta = "2" Then kt2kb() If valinta >= "2" Or "0" Then MessageBox.Show("No ei tommosta valintaa ookkaan", "kb2kt", MessageBoxButtons.OK, MessageBoxIcon.Error) End End Sub Private Sub kb2kt() Dim koobeet, koobeevastaus As String koobeet = InputBox("Montako kilobittiä?", "kb2kt") koobeevastaus = koobeet * +0.125 MessageBox.Show("Tulos: " & koobeevastaus & " kilotavua", "kb2kt", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) End End Sub Private Sub kt2kb() Dim kooteet, kooteevastaus As String kooteet = InputBox("Montako kilotavua?", "kb2kt") kooteevastaus = kooteet / +0.125 MessageBox.Show("Tulos: " & kooteevastaus & " kilotavua", "kb2kt", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) End End Sub End Class
Aihe on jo aika vanha, joten et voi enää vastata siihen.