1. Welcome to PHCorner Forums. Take a moment to Sign up and gain unlimited access and extra privileges that guests are not entitled to, such as:

    All that and more! Registration is quick, simple and absolutely free. Join our community today!

Visual Basic Mga kuya pa help nmn New in programing

Discussion in 'Coding, Programming' started by junee31, Dec 12, 2015.

  1. Pa help nmn poh dko malagyan ng Value ung combo box iba ung lumalabas

    Public Class Form1
    Dim y As String
    Dim cat As Integer
    Dim value As Integer

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    ComboBox1.Items.Add("1")
    ComboBox1.Items.Add("2")
    ComboBox1.Items.Add("3")
    ComboBox1.Items.Add("4")
    ComboBox1.Items.Add("5")
    ComboBox1.Items.Add("6")
    ComboBox1.Items.Add("7")
    ComboBox1.Items.Add("8")
    ComboBox1.Items.Add("9")
    ComboBox1.Items.Add("10")
    ComboBox2.Items.Add("cat")
    ComboBox2.Items.Add("dog")
    ComboBox2.Items.Add("Mike Gold")
    ComboBox2.Items.Add("Praveen Kumar")
    ComboBox2.Items.Add("Raj Beniwal")
    ComboBox2.Items.Add("wow")
    y = ComboBox2.SelectedItem
    End Sub
    Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
    If y = "cat" Then
    value = "300"
    End If

    If y = "dog" Then
    value = "250"
    End If

    If ComboBox1.SelectedIndex > -1 Then
    TextBox1.Text = CStr(ComboBox1.SelectedItem)
    End If
    If ComboBox2.SelectedIndex > -1 Then
    TextBox2.Text = CStr(ComboBox2.SelectedItem)
    End If
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    TextBox3.Text = TextBox1.Text * TextBox2.Text

    End Sub
    End Class


    [​IMG]
    dko lng alam bkt lumalabas ung Dog sa price Any idea poh pls
     
  2. sir ano name nung Textbox mo katabi nung php?
     
  3. sjwarrior

    sjwarrior Addict Established

    Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged

    If ComboBox1.SelectedIndex > -1 Then
    TextBox1.Text = CStr(ComboBox1.SelectedItem)
    End If
    If ComboBox2.SelectedIndex > -1 Then
    y= CStr(ComboBox2.SelectedItem)
    End If

    If y = "cat" Then
    value = "300"
    End If

    If y = "dog" Then
    value = "250"
    End If
    TextBox2.Text = value
    End Sub

    Dapat ganito ito, mahuhuli yung conversion ng cat and dog to 300 and 250 respectively.
     
Tags / Keywords: