combobbox

sajeel

Member
Joined
Jul 9, 2008
Messages
17
Programming Experience
Beginner
i have two comboboxes i loaded comboboxes with a a xml file

HTML:
<domains>

  <domain  name="Billing">
    <field>clsname1</field>
  </domain>

  <domain  name="classdomain">
    <field>clsname2</field>
  </domain>
  </domains>

VB.NET:
Dim streamRead As New System.IO.FileStream("..\..\services.xml", _
                      System.IO.FileMode.Open)
        dsAppNames.ReadXml(streamRead)
            streamRead.Close()

       
        cmb_AppSource.DataSource = dsAppNames.tables(0)
        cmb_AppSource.DisplayMember = "name"
          cmbapp_distination.DataSource = dsAppNames.tables(0)

          cmbapp_distination.DisplayMember = "field"
when i changed the name in 1st comobox filed name is changing

i dont want to change field when i selecting the 2 nd combobx
 
combobox

hi
i am binding combobx with a class

VB.NET:
Public Class DataItem
    Private _Text As String
    Private _Value As Integer
    Public Sub New(ByVal value As Integer, ByVal text As String)
        _Text = text
        _Value = value

    End Sub
    Public ReadOnly Property value() As String
        Get
            Return _Value
        End Get
    End Property

    ' This is the property that holds the extra data. 
    Public Property ItemData() As Integer
        Get
            Return _Value
        End Get
        Set(ByVal iValue As Integer)
            _Value = iValue
        End Set
    End Property

    Public ReadOnly Property text() As String
        Get
            Return _Text
        End Get
    End Property

    Public Overrides Function ToString() As String
        Return text


    End Function

End Class

Bind Text and Value to CmbMode Combobox with DataItem Class
'cmbMode.Items.Add(New DataItem(1, "Realtime"))
'cmbMode.Items.Add(New DataItem(2, "Asynchronous"))
'cmbMode.Items.Add(New DataItem(3, "SemiSynchronous"))



.here i wnat to save cmbmode combobox selected item value into a xml file

dr("Mode") = CType(cmbMode.SelectedItem, DataItem).value


it s fine. but
when i change the cmbmode combobox selected item i am getting the text not the value of selected item in.... xmlfile
 
Back
Top