I wanted to ask how to get combobox's selected value then display it to multiple textboxes. The combobox is populated with illnesses from the database. Now when an illness is selected from combobox, the symptoms of that illness should be displayed in many textboxes. Currently I have 10 textboxes for the symptoms. The table structure is id, illness, symptoms. Here's my code:
Dim mycmd As New MySqlCommand
Dim dtr As MySqlDataReader
Call Connect()
Dim str As String
str = "Select symptoms from diagnose where illness = @ill"
mycmd.Parameters.AddWithValue("ill", cmbRecord.Text)
mycmd.CommandText = str
dtr = mycmd.ExecuteReader
While dtr.Read()
symp0.Text = dtr("symptoms")
symp1.Text = dtr("symptoms")
symp2.Text = dtr("symptoms")
symp3.Text = dtr("symptoms")
symp4.Text = dtr("symptoms")
symp5.Text = dtr("symptoms")
symp6.Text = dtr("symptoms")
symp7.Text = dtr("symptoms")
symp8.Text = dtr("symptoms")
symp9.Text = dtr("symptoms")
End While
myConn.Close()
when an illness is selected from the combobox the symptoms should display on those textboxes. Say the selected illness has only 4 symptoms in the table, then symp0
to symp3
textbox will show the symptoms one by one and leaving the remaining textboxes blank.
The problem is that when an illness is selected, those textboxes displays only the last symptom of that illness stored in the database.
Example: fever. In the table, it has 4 symptoms: cold, hot temperature, headache, dizziness. If fever is selected, only dizziness is displayed from symp0
to symp9
textboxes.