Visual Basic (Declaration) | |
---|---|
<DescriptionAttribute("Specifies the source of the sound file to play.")> <DefaultValueAttribute()> <CategoryAttribute("Behavior")> Public Property Source As String |
Visual Basic (Usage) | Copy Code |
---|---|
Dim instance As LiveSound Dim value As String instance.Source = value value = instance.Source |
C# | |
---|---|
[DescriptionAttribute("Specifies the source of the sound file to play.")] [DefaultValueAttribute()] [CategoryAttribute("Behavior")] public string Source {get; set;} |
C++/CLI | |
---|---|
[DescriptionAttribute("Specifies the source of the sound file to play.")] [DefaultValueAttribute()] [CategoryAttribute("Behavior")] public: property String^ Source { String^ get(); void set ( String^ value); } |
Property Value
The path of the sound file.
The following example demonstrates adding items to a Live List control from a database, as well as updating a LiveImage control.
Visual Basic | Copy Code |
---|---|
'In this example, items are added to a Live List using Items.Add 'The items are sounds to be played, located in a "sounds" folder 'When one of the items is selected, the corresponding sound is played 'LiveList1 could be a LiveListBox, LiveDropDownList, LiveRadioButtonList or LiveCheckBoxList Private Sub LiveButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LiveButton1.Click 'Add items to the Live list control via the ListItemCollection LiveList1.Items.Add("chord.wav") LiveList1.Items.Add("chimes.wav") LiveList1.Items.Add("exclamation.wav") LiveList1.Items.Add("error.wav") End Sub Private Sub LiveList1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LiveList1.SelectedIndexChanged 'When an item in the LiveList is selected or de-selected 'The selected sound that is topmost in the list will play If (LiveList1.SelectedIndex > -1) Then LiveSound1.Source = "sounds/" + LiveList1.Items(LiveList1.SelectedIndex).ToString() LiveSound1.Play() End If End Sub |
C# | Copy Code |
---|---|
//In this example, items are added to a Live List using Items.Add //The items are sounds to be played, located in a "sounds" folder //When one of the items is selected, the corresponding sound is played //LiveList1 could be a LiveListBox, LiveDropDownList, LiveRadioButtonList or LiveCheckBoxList private void LiveButton1_Click(object sender, System.EventArgs e) { //Add items to the Live List control via the ListItemCollection LiveList1.Items.Add("chord.wav"); LiveList1.Items.Add("chimes.wav"); LiveList1.Items.Add("exclamation.wav"); LiveList1.Items.Add("error.wav"); } private void LiveList1_SelectedIndexChanged(object sender, System.EventArgs e) { //When an item in the Live List is selected or de-selected //The selected sound that is topmost in the list will play if (LiveList1.SelectedIndex > -1) { LiveSound1.Source = "sounds/" + LiveList1.Items[LiveList1.SelectedIndex]; LiveSound1.Play(); } } |
Use this property to specify the path of a sound file to play when the LiveSound.Play is invoked.
Target Platforms: Microsoft .NET Framework 2.0