1

i cant figure out my problem there is no error but value in combobox not showing from mysqldatabase here is my code

    Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    Dim conn As New MySqlConnection

    conn.ConnectionString = "server=localhost;user vbid=root;password=admin;database=dnidb"

    Dim reader As MySqlDataReader

    Try
        conn.Open()
        Dim query As String
        query = "select * from dnidb.hargapro where NamaP = '" & ComboBox1.Text & "'"
        command = New MySqlCommand(query, conn)
        reader = command.ExecuteReader
        While reader.Read
            TextBox8.Text = reader.GetInt32("HargaP")
          End While
        conn.Close()
    Catch ex As Exception
        MessageBox.Show(ex.Message)
    Finally
        conn.Dispose()
    End Try


End Sub

this code was no error, but didnt show anything in the combobox, i try to make this cone on combobox_selectedindexchanges and same thing nothing showing up in the combobox

i just follow the code from here https://www.youtube.com/watch?v=HfnoGEmRGvc

3
  • I don't really understand your question, but I don't see any code that tries to add anything to a ComboBox. Can you clarify what you are trying to do and what is going wrong? Commented Aug 17, 2017 at 3:58
  • i want to list product name from my database into combobox and whenever i click one of the combobox item i want the price show on other textbox and the price from database to Commented Aug 17, 2017 at 4:26
  • I don't see any code to take product names from the database and put them in the ComboBox. Commented Aug 17, 2017 at 12:47

1 Answer 1

1

I don't see any code that tries to retrieve the product names to combobox, and it seems like the above code should be on SelectedIndexChanged event of the combobox.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.