hello friends,
DDL = Drop Down List
i retrieve the ddl items from sql2005 table and succeded to display it
but when i change the ddl index.. the items i choose contains the old values
so even i change the index value when i save it into database.. there's nothing changed.. i also already test using msgbox and it only show the old values..
i wonder where's my mistakes
thank u so much for any replies..
pvDest2 values is always the old ( the initial values retreived from table database) even i already changed the DDL index..
i want when i change the DDL index or values then the global variable's value pvDest2 is containing the value i choose
DDL = Drop Down List
i retrieve the ddl items from sql2005 table and succeded to display it
but when i change the ddl index.. the items i choose contains the old values
so even i change the index value when i save it into database.. there's nothing changed.. i also already test using msgbox and it only show the old values..
i wonder where's my mistakes
thank u so much for any replies..
VB.NET:
Sub ddlDest2i_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlDest2i.SelectedIndexChanged
'pvDest2 = ddlDest2i.SelectedValue.ToString
'pvDest2 = ddlDest2i.SelectedItem.Text
Dim pvDest2 As String = ""
pvDest2 = ddlDest2i.Text
'or pvDest2 = ddlDest2i.SelectedValue
'or pvDest2 = ddlDest2i.SelectedItem.Value is the same..
MessageBox.Show(pvDest2, "Destina2", MessageBoxButtons.OK)
End Sub
VB.NET:
Protected Sub formc_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles formc.Load
retTblCountry(ddlDest1i, "TRAVEL_COUNTRY")
End Sub
'code For retrieve table country
Sub retTblCountry(ByVal NamaCbx As Object, ByVal NamaTbl As String)
Try
'openCon()
Dim da As New SqlDataAdapter
Dim ds As New DataSet
Dim cb As New SqlCommandBuilder
da = New SqlDataAdapter("SELECT DISTINCT COUNTRY FROM " & NamaTbl, con)
cb = New SqlCommandBuilder(da)
da.Fill(ds, "CTRY") 'ds -> ds.tables(0)
For i As Integer = 0 To ds.Tables("CTRY").Rows.Count - 1
NamaCbx.items.add(ds.Tables("CTRY").Rows(i)(0))
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
pvDest2 values is always the old ( the initial values retreived from table database) even i already changed the DDL index..
i want when i change the DDL index or values then the global variable's value pvDest2 is containing the value i choose